Skip to content
0:00 / 0:00

#haskell#ghc#typeconstructors

MuniHac 2020: Richard Eisenberg - Partial Type Constructors

TNG Technology Consulting GmbH

5K subscribers • 17 videos on Hallway

YouTube
  • Recommended by 3 people: 3 in engineering communities.
  • Presented by Richard Eisenberg

Advanced. Deep dive for people who know the field.

997 views6 years ago3 recommendations

Programming languagesHaskellLanguage design and type systems

Richard Eisenberg proposes explicitly partial type constructors in Haskell to allow constraints like Ord on Set within Functor instances.

Title: Partial Type Constructors Speaker: Richard Eisenberg When we describe the type Set a, we say that this type makes sense for any a. But this is a small lie: it really only makes sense for types a that have an ordering – that is, types for which Ord a holds. This small lie has far-reaching consequences. It means that we cannot write a Functor instance for Set, it means we might accidentally write uncallable functions that take a Set, and it means we must repetitively write Ord a ... constraints on every function working with Sets. This talk will explore the possibility of explicitly partial type constructors, where we can declare loudly that types like Set work only with some type arguments, but not others. The design proposed improves error messages, simplifies type signatures, and allows instances like Functor over Sets. MuniHac 2020, September 11 / munihac.de/ TNG Technology Consulting GmbH / tngtech.com

Why it's here

3 people recommend this

What people say. Recommended for its proposal on implementing DatatypeContexts and allowing Ord constraints in Functor instances.

u/ysangkokin r/haskell • Recommends

MuniHac Partial Type Constructors - Richard Eisenberg

u/Noughtmarein r/haskell • Recommends

On “Monthly Hask Anything (October 2020)”

There was a recent presentation about a new way to properly implement DatatypeContexts: link to this video DatatypeContexts is mentioned at 12:35. There is also a paper accepted at POPL: https://popl20.sigplan.org/details/POPL-2020-Research-Papers/12/Partial-Type-Constructors-Or-Making-Ad-Hoc-Datatypes-Less-Ad-Hoc.

u/NNOTMin r/haskell • Recommends

On “What are some of the more pragmatic names for functor/applicative/monads?”

…e fmap' f . fmap' g = fromList . fmap f . toList . fromList . fmap g . toList = fromList . fmap f . fmap g . toList = fromList . fmap (f . g) . toList = fmap' (f . g) In fact, Richard Eisenberg presented a possible extension to GHC a while back that would make it possible to have the Ord constraint in a Functor instance IIRC: link to this video…

u/NNOTMin r/haskell • Recommends

On “What are some of the more pragmatic names for functor/applicative/monads?”

…ap' :: Ord b => (a -> b) -> Set a -> Set b     fmap' f = fromList . fmap f . toList follows the functor law, I thought I had it but made a mistake, and so don't actually have a proof for it. However, Richard Eisenberg presented a possible extension to GHC a while back that would make it possible to have the Ord constraint in a Functor instance:  link to this video…