Type Classes

Share this post

Problems with products, part 2

typeclasses.substack.com

Problems with products, part 2

Higher-kinded products

Chris Martin
Nov 18, 2022
Share this post

Problems with products, part 2

typeclasses.substack.com

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.

Already a paid subscriber? Sign in
© 2023 Mission Valley Software LLC
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing