-
Notifications
You must be signed in to change notification settings - Fork 11
Add new generic function: hinitialize #19
Copy link
Copy link
Open
Description
I found it often useful to have an easy way to generically initialize e.g. a record:
data FillRec = FillRec
instance Initialization FillRec Int where
initialization _ = 1
instance Initialization FillRec Char where
initialization _ = 'a'
myRec :: { foo :: Int, bar :: Int, baz :: Char }
myRec = hinitialize FillRec> myRec
{ bar: 1, baz: 'a', foo: 1 }
What do you think? Would it make sense to add this to the library? I have a branch in my fork that implements Initialization and InitializationWithIndex for records.
Alternative names would be: Replicate, Init, Fill....
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels