Utils.purs 474 Bytes
Newer Older
1
module Gargantext.Utils where
2 3 4 5 6 7 8 9 10 11 12 13 14

import Prelude

import Data.Newtype (class Newtype, unwrap, wrap)

setterv :: forall nt record field. Newtype nt record => (record -> field -> record) -> field -> nt -> nt
setterv fn v t = (setter (flip fn v) t)

setter :: forall nt record. Newtype nt record => (record -> record) -> nt -> nt
setter fn = wrap <<< fn <<< unwrap

getter :: forall record field nt. Newtype nt record => (record -> field) -> nt -> field
getter fn = fn <<< unwrap