I have following data type definition:
newtype Combine a b =
Combine { unCombine :: a -> b }
and then I can defined as follow:
Prelude> let f = Combine $ \n -> Sum (n + 1)
My question is, how to use f?
Prelude Data.Monoid> unCombine f 1
Sum {getSum = 2}
Prelude Data.Monoid> unCombine f 42
Sum {getSum = 43}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With