Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Symparsec/Parser/While/Predicates.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,11 @@ type family IsDecDigit ch where
type IsDecDigitSym :: Char ~> Bool
data IsDecDigitSym ch
type instance App IsDecDigitSym ch = IsDecDigit ch

type Elem :: [a] -> a -> Bool
type family Elem where
Elem (_:xs) x = Elem xs x
Elem '[] _ = 'False
Elem (x':_) x = 'True
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above two equations match both x:xs and [] cases, so this equation will never be reached. Also, did you intend to assert that x' and x are equivalent? In which case, it should be Elem (x:_) x = True.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to do `Elem (x ': xs) x = 'True

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, of course. I tend to avoid ticked promoted constructors except where required to disambiguate. Further reading: https://gitlab.haskell.org/ghc/ghc/-/issues/20531

data ElemSym lst ch
type instance (App (ElemSym lst)) a = Elem lst a