Closed At-sushi closed 9 months ago
coinclusion
wrench
retrench
Data.Extensible.Nullable
Implemented for the convenience. These can be used to defaulting record values.
{-# LANGUAGE DataKinds, TypeOperators, FlexibleContexts, OverloadedLabels, OverloadedStrings, PolyKinds #-} import Data.Extensible type Parameters = Record '[ "name" >: String , "width" >: Int , "height" >: Int , "id" >: Int ] defaultPara :: Parameters defaultPara = #name @= "untitled" <: #width @= 640 <: #height @= 480 <: #id @= -1 <: nil main :: IO () main = do let para = #id @= 0 <: #name @= "testApp" <: nil result = setDefaultValues defaultPara para print result -- name @= "testApp" <: width @= 640 <: height @= 480 <: id @= 0 <: nil setDefaultValues :: (Generate ys, IncludeAssoc ys xs) => (ys :& h) -> (xs :& h) -> (ys :& h) setDefaultValues ys = hzipWith fromNullable ys . wrenchAssoc
Features
coinclusion
,wrench
,retrench
inData.Extensible.Nullable
.Implemented for the convenience. These can be used to defaulting record values.
Example use-case