Problems with products, part 2
Higher-kinded products
Definitions carried over from part one:
newtype Decode k v a = Decode{ decode :: Map k v -> a }
newtype Encode k v a = Encode{ encode :: a -> Map k v }
data Codec k v a = Codec{ co :: Encode k v a, dec :: Decode k v a }
I first saw the following technique used with optparse-applicative
, though I cannot remember where. Here is a typical-looking type that m…
Keep reading with a 7-day free trial
Subscribe to Type Classes to keep reading this post and get 7 days of free access to the full post archives.