on master help sign in
Semigroupoids instances for Query 😈
commit98fd6f493444c305ced8ca1064aed805e33c9132 authorShane O'Brien <shane.obrien@circuithub.com> dateWed 24 Mar 2021, 21:01 (6 years ago) parentf5f9256
1 file changed+10
src/Rel8/Query.hs+10
src/Rel8/Query.hs+10
@@ -1,4 +1,5 @@
11{-# language DerivingStrategies #-}
2+{-# language DerivingVia #-}
23{-# language GeneralizedNewtypeDeriving #-}
34{-# language StandaloneKindSignatures #-}
45
@@ -22,12 +23,21 @@ import Rel8.Table.Alternative
2223 , AlternativeTable, emptyTable
2324 )
2425
26+-- semigroupoids
27+import Data.Functor.Apply ( Apply, WrappedApplicative(..) )
28+import Data.Functor.Bind ( Bind, (>>-) )
29+
2530
2631-- | The @Query@ monad allows you to compose a @SELECT@ query. This monad has
2732-- semantics similar to the list (@[]@) monad.
2833type Query :: Type -> Type
2934newtype Query a = Query (Opaleye.Select a)
3035 deriving newtype (Functor, Applicative, Monad)
36+ deriving Apply via (WrappedApplicative Opaleye.Select)
37+
38+
39+instance Bind Query where
40+ (>>-) = (>>=)
3141
3242
3343-- | '<|>:' = 'unionAll'.