Copyright | (c) Andrey Mulik 2020 |
---|---|
License | BSD-style |
Maintainer | work.a.mulik@gmail.com |
Safe Haskell | Safe |
Language | Haskell2010 |
Data.Field
provides fake field type for record-style operations.
Synopsis
- data SField m record a = SField {}
- type SOField = Observe SField
- sfield :: Monad m => (record -> m a) -> (record -> a -> m ()) -> Field m record a
- data Field m record a = Field {
- getField :: !(record -> m a)
- setField :: !(record -> a -> m ())
- modifyField :: !(record -> (a -> a) -> m a)
- type OField = Observe Field
- data Observe field m record a = Observe {}
- observe :: Monad m => field m record a -> Observe field m record a
Simple field
data SField m record a Source #
Simple field, which contain only getter and setter.
Instances
SwitchProp Field record => SwitchProp SField record Source # | |
ModifyProp SField record Source # | |
Defined in Data.Field modifyRecord :: Monad m => SField m record a -> record -> (a -> a) -> m a Source # | |
SetProp SField record Source # | |
GetProp SField record Source # | |
DeleteProp Field record many => DeleteProp SField record many Source # | |
Defined in Data.Field | |
InsertProp Field record many => InsertProp SField record many Source # | |
Defined in Data.Field prependRecord :: Monad m => a -> SField m record (many a) -> record -> m (many a) Source # appendRecord :: Monad m => a -> SField m record (many a) -> record -> m (many a) Source # |
sfield :: Monad m => (record -> m a) -> (record -> a -> m ()) -> Field m record a Source #
Create Field
from getter and setter.
Field
data Field m record a Source #
Normal field, which contain getter, setter and modifier.
Field | |
|
Instances
SwitchProp Field Bool Source # | |
Integral switch => SwitchProp Field switch Source # | |
ModifyProp Field record Source # | |
Defined in Data.Field modifyRecord :: Monad m => Field m record a -> record -> (a -> a) -> m a Source # | |
SetProp Field record Source # | |
GetProp Field record Source # | |
DeleteProp Field record [] Source # | |
Defined in Data.Field | |
InsertProp Field record [] Source # | |
Defined in Data.Field prependRecord :: Monad m => a -> Field m record [a] -> record -> m [a] Source # appendRecord :: Monad m => a -> Field m record [a] -> record -> m [a] Source # |
Observable field
data Observe field m record a Source #
Simple field observer, which can run some handlers after each action.
Instances
SwitchProp field a => SwitchProp (Observe field) a Source # | |
ModifyProp field record => ModifyProp (Observe field) record Source # | |
Defined in Data.Field modifyRecord :: Monad m => Observe field m record a -> record -> (a -> a) -> m a Source # | |
SetProp field record => SetProp (Observe field) record Source # | |
GetProp field record => GetProp (Observe field) record Source # | |
DeleteProp field record many => DeleteProp (Observe field) record many Source # | |
Defined in Data.Field | |
InsertProp field record many => InsertProp (Observe field) record many Source # | |
Defined in Data.Field prependRecord :: Monad m => a -> Observe field m record (many a) -> record -> m (many a) Source # appendRecord :: Monad m => a -> Observe field m record (many a) -> record -> m (many a) Source # |