Formatting higher order functions and forall's
What I am aiming for
{-# LANGUAGE ExplicitForAll #-}
module Main where
fn
:: forall m s
. ( Constraint m
, Constraint s
)
=> (Type -> s)
-> (forall a. m a -> s -> IO a)
-> Type
-> (forall a. m a -> IO a)
fn mkState runner kc
= go
where
go
:: m a
-> IO a
go act
= runner act
$ mkState kc
What I am getting from floskell (it could just be a config issue but im having a lot of trouble tweaking it to disambiguate the inner -> and .
{-# LANGUAGE ExplicitForAll #-}
module Main where
fn
:: forall m s
. (Constraint m, Constraint s)
=> (Type
-> s)
-> (forall a
. m a
-> s
-> IO a)
-> Type
-> (forall a
. m a
-> IO a)
fn mkState runner kc
= go
where
go
:: m a
-> IO a
go act
= runner act
$ mkState kc
In particular I cant seem to get the spacing around the outer . correct, or the disambiguation between inner and outer . and ->, and the vertical alignment of the constraints.
Here is a link to the config I have messed around with (https://gist.github.com/merc1031/25006873e4204efcc9f081b335e29a29)
Thanks
The alignment and padding of operators in vertical layouting is very ad-hoc and hard-coded at the moment. You will not be able to right-align . with => and -> at the moment.
There is also no way to distinguish operators based on some nesting level. The best choice you have at the moment is type: try-oneline with optional newlines before the operator. That will get you the linebreaks on the outermost arrows while keeping the inner arrows on one line, but only if the outer type expression is long enough to require multiple lines.