3 ms·
One difference with monads at least in Haskell is we have the concepts of lifting a computation in one type to a type of another (Monad Transformers), and then
by jeremyjh 5y ago
One difference with monads at least in Haskell is we have the concepts of lifting a computation in one type to a type of another (Monad Transformers), and then dropping those transformations to a base type (such as IO) via monad-control. This lets you pretty easily call functions of different colors without a lot of manual wrapping and unwrapping. To make it super convenient you do need to use a lifted version of the base library, which is sort of like a color-agnostic set of IO functions that can be directly called from any transformer stack that implements the proper typeclasses.
https://hackage.haskell.org/package/monad-control https://hackage.haskell.org/package/monad-control
https://hackage.haskell.org/package/lifted-base https://hackage.haskell.org/package/lifted-base
- Akronymus 5y agoIsn't that a direct result of having higher kinded types/abstracting over the type constructor?
- jeremyjh 5y agoCertainly but Scala has that, and it has typeclass like implicits. I'm not sure if it can do monad-control though, here is a list of all the type extensions used for that: RankNTypes , TypeFamilies , FunctionalDependencies , FlexibleInstances , UndecidableInstances , MultiParamTypeClasses
- Akronymus 5y agoOne day ill make the jump from "just" f# to haskell. While i usually could solve it in a different way, such things would have made it quite a bit nicer (the zoo of .map, .fold and such is a bit annoying)