35 lines
852 B
Haskell
35 lines
852 B
Haskell
{-# LANGUAGE NoImplicitPrelude #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
{-# LANGUAGE FunctionalDependencies #-}
|
|
module Utils.Lens ( module Utils.Lens ) where
|
|
|
|
import Import.NoFoundation
|
|
import Control.Lens as Utils.Lens
|
|
import Utils.Lens.TH
|
|
|
|
import qualified Database.Esqueleto as E (Value(..),InnerJoin(..))
|
|
|
|
_unValue :: Lens' (E.Value a) a
|
|
_unValue f (E.Value a) = E.Value <$> f a
|
|
|
|
_InnerJoinLeft :: Lens' (E.InnerJoin l r) l -- forall f. Functor f => (a -> f a) -> s -> f s
|
|
_InnerJoinLeft f (E.InnerJoin l r) = (`E.InnerJoin` r) <$> f l
|
|
|
|
_InnerJoinRight :: Lens' (E.InnerJoin l r) r
|
|
_InnerJoinRight f (E.InnerJoin l r) = (l `E.InnerJoin`) <$> f r
|
|
|
|
|
|
makeLenses_ ''Entity
|
|
|
|
makeLenses_ ''Course
|
|
|
|
makeLenses_ ''SheetCorrector
|
|
|
|
makeLenses_ ''SubmissionGroup
|
|
|
|
-- makeClassy_ ''Load
|
|
|
|
|