Closed felixwiemuth closed 1 year ago
A general comment:
Okay. Good point with Result
, I'll check the instances for it when I come to Monad.
Result/Validation may not be possible at the moment. See https://github.com/flix/flix/issues/1535
Is the pragmatic path to change the order of the type params for Validation and Result?
There will be quite a bit of code breakage - but if they are left longer there would be more breakage (if changing the param order remains the solution).
In Haskell fun deps and type families are the (competing) ways of programming on the "non-last" type params for some situations but dropping the last param of objects like Result is the way to make them kind -> so they can work with Functor, Applicative, Monad.
This is an overview on the implementation status of the
Functor
,Applicative
andMonad
typeclasses.Conventions for implementation, test and documentation
When implementing Applicative, I established some conventions (discussable of course):
Notes on some type classes
Applicative
liftA2
as known from e.g. Haskell (plusliftA3
, ...,liftA5
)lift2
, ...,lift5
though, as used in other places in the Flix standard library. These can also implement a more efficient version if possible, in which caseliftAX
would redirect toliftX
.Implementation
ap
,liftA2
, T:liftX
)