News for hackers. Stuff that matters.
Re:What Color Is Your Monad by jeremyjh on Wednesday February 16, 2022 @09:57AM (#30360768)
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/lifted-base

Re:What Color Is Your Monad by Akronymus on Wednesday February 16, 2022 @02:42PM (#30364717)
Isn't that a direct result of having higher kinded types/abstracting over the type constructor?
Re:What Color Is Your Monad by jeremyjh on Wednesday February 16, 2022 @04:12PM (#30365748)
Certainly 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
Re:What Color Is Your Monad by Akronymus on Wednesday February 16, 2022 @05:11PM (#30366490)
One 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)