Hacker News new | ask | show | jobs
by DanWaterworth 4076 days ago
This is actually possible with the ConstraintKinds extension in GHC.

    type Mappable = Functor
    type NotScaryFluffyThing = Monad
This makes Mappable a synonym for Functor and likewise for Monad. (This is not necessarily a good idea; it goes against the principle of least surprise, but it'll work).
2 comments

My code definitely needs more NotScaryFluffyThings in it.
Isn't aliasing types a core language feature?
Functor and Monad are technically not types but type classes (i.e. interface vs an implementing class), hence why simple/naive type aliasing is not enough.