From 7bae9ca92e4f06bc51c744fac518b686c297f227 Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Sun, 3 Jan 2021 00:16:36 +0200 Subject: [PATCH] More type safety on string types? --- src/Data/Query.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Query.hs b/src/Data/Query.hs index ad121a6..4ccd18b 100644 --- a/src/Data/Query.hs +++ b/src/Data/Query.hs @@ -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