More type safety on string types?
This commit is contained in:
parent
9048581ea1
commit
7bae9ca92e
@ -29,18 +29,18 @@ data Field a where
|
|||||||
Title :: Field String
|
Title :: Field String
|
||||||
|
|
||||||
data QueryF f where
|
data QueryF f where
|
||||||
StartsWith :: Field a -> a -> QueryF f
|
StartsWith :: Field String -> String -> QueryF f
|
||||||
EndsWith :: Field a -> a -> QueryF f
|
EndsWith :: Field String -> String -> QueryF f
|
||||||
And :: f -> f -> QueryF f
|
And :: f -> f -> QueryF f
|
||||||
|
|
||||||
deriving instance Functor QueryF
|
deriving instance Functor QueryF
|
||||||
|
|
||||||
type Query = Fix QueryF
|
type Query = Fix QueryF
|
||||||
|
|
||||||
startsWith :: Field a -> a -> Query
|
startsWith :: Field String -> String -> Query
|
||||||
startsWith field x = Fix (StartsWith field x)
|
startsWith field x = Fix (StartsWith field x)
|
||||||
|
|
||||||
endsWith :: Field a -> a -> Query
|
endsWith :: Field String -> String -> Query
|
||||||
endsWith field x = Fix (EndsWith field x)
|
endsWith field x = Fix (EndsWith field x)
|
||||||
|
|
||||||
(.&&.) :: Query -> Query -> Query
|
(.&&.) :: Query -> Query -> Query
|
||||||
|
Loading…
Reference in New Issue
Block a user