Type Classes

Type Classes

Problems with products, part 2

Higher-kinded products

Chris Martin's avatar
Chris Martin
Nov 18, 2022
∙ Paid

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…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2026 Mission Valley Software LLC · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture