Skip to content

Formalize Prefix, Suffix and Infix as relations on Lists #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
gallais opened this issue Nov 2, 2018 · 3 comments
Closed
2 of 3 tasks

Formalize Prefix, Suffix and Infix as relations on Lists #517

gallais opened this issue Nov 2, 2018 · 3 comments

Comments

@gallais
Copy link
Member

gallais commented Nov 2, 2018

Rather than Haskell's

isPrefixOf :: Eq a => [a] -> [a] -> Bool
isSuffixOf :: Eq a => [a] -> [a] -> Bool
isInfixOf :: Eq a => [a] -> [a] -> Bool

it would be nice to have evidence-producing versions of these functions. Note that
Data.List.Relation.Sublist already gives us that for isSubsequenceOf.

@gallais
Copy link
Member Author

gallais commented Feb 13, 2019

Something to think about: Suffix could be generalised to

module _ (R : REL (List A) (List B) r) where

  data Suffix : REL (List A) (List B) (a ⊔ b ⊔ r) where
    here  :  {as bs}  R as bs  Suffix as bs
    there :  {b as bs}  Suffix as bs  Suffix as (b ∷ bs)

We then recover the usual suffix as Suffix (Pointwise R) but we can also get
Infix as Suffix (Prefix R).

@jamesmckinna
Copy link
Contributor

jamesmckinna commented May 11, 2024

Is this issue not already closed by the existing definitions under Data.List.Relation.Binary.*, or is there more to say/do here?

UPDATED: it seems as though Data.List.Relation.Binary.Infix.Homogeneous.Properties is an incomplete stub, but that Data.List.Relation.Binary.Infix.Heterogeneous{.Properties} is all there, so... leave this open? Or close?

@MatthewDaggitt
Copy link
Contributor

I think close. If people want to open an issue for extending the Infix stub then they can...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants