More type safety on string types?

This commit is contained in:
Mats Rauhala 2021-01-03 00:16:36 +02:00
parent 9048581ea1
commit 7bae9ca92e

View File

@ -29,18 +29,18 @@ data Field a where
Title :: Field String
data QueryF f where
StartsWith :: Field a -> a -> QueryF f
EndsWith :: Field a -> a -> QueryF f
StartsWith :: Field String -> String -> QueryF f
EndsWith :: Field String -> String -> QueryF f
And :: f -> f -> QueryF f
deriving instance Functor QueryF
type Query = Fix QueryF
startsWith :: Field a -> a -> Query
startsWith :: Field String -> String -> Query
startsWith field x = Fix (StartsWith field x)
endsWith :: Field a -> a -> Query
endsWith :: Field String -> String -> Query
endsWith field x = Fix (EndsWith field x)
(.&&.) :: Query -> Query -> Query