Skip to content

Instantly share code, notes, and snippets.

@smurphy8
Created May 9, 2014 14:22
Show Gist options
  • Save smurphy8/da90f1edf364983937c0 to your computer and use it in GitHub Desktop.
Save smurphy8/da90f1edf364983937c0 to your computer and use it in GitHub Desktop.
lens page example
{-# LANGUAGE OverloadedStrings,TemplateHaskell, MultiParamTypeClasses
, FunctionalDependencies, FlexibleInstances, RecordWildCards #-}
module AlarmState.Lens where
import qualified Protocol.Mir3.Simple.Mir3SimpleTypes as M
import Alarm.DB.Types
import AlarmState.Types (AlarmRunner,AlarmParameters,People,Person,AlarmState
,AnyAlarm(..),AnyCall(..),AlarmCallout(..) ,InProgress(..)
,CallResponse(..),AnyCount(..),ValidCall(..))
import Control.Lens
makeClassy_ ''AlarmStateConfig
makeClassy_ ''CallOrderUser
makeClassy_ ''AlarmRunner
makeClassy_ ''AlarmParameters
makeClassy_ ''People
makeClassy_ ''Person
makeClassy_ ''AlarmState
makeClassy_ ''ValidCall
makeClassy_ ''CallResponse
makePrisms ''M.Mir3Result
makePrisms ''AnyAlarm
makePrisms ''AnyCall
makePrisms ''AlarmCallout
makePrisms ''InProgress
makePrisms ''CallResponse
makePrisms ''AnyCount
-- ascToCOUlens = _alrmCallOrderUsrs
makeLenses_ t = makeLensesWith ?? t $ defaultRules & lensField .~ \x -> Just (x ++ "_")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment