src/Brick/Widgets/HelpMessage.hs:82:19: error:
• Couldn't match type: forall s1. EventM n s1 ()
with: EventM n s ()
Expected: ViewportScroll n -> EventM n s ()
Actual: ViewportScroll n -> forall s. EventM n s ()
• In the first argument of ‘(.)’, namely ‘vScrollToBeginning’
In the expression: vScrollToBeginning . scroller
In an equation for ‘resetHelpWidget’:
resetHelpWidget = vScrollToBeginning . scroller
• Relevant bindings include
resetHelpWidget :: HelpWidget n -> EventM n s ()
(bound at src/Brick/Widgets/HelpMessage.hs:82:1)
|
82 | resetHelpWidget = vScrollToBeginning . scroller
| ^^^^^^^^^^^^^^^^^^
Error: cabal: Failed to build hledger-iadd-1.3.18 (which is required by
exe:hledger-iadd from hledger-iadd-1.3.18).
Consider the following functions:
vScrollToBeginning :: forall n. ViewportScroll n -> forall s. EventM n s ()
scroller :: forall n. HelpWidget n -> ViewportScroll n
(.) :: forall p q r. (q -> r) -> (p -> q) -> p -> r`
In vScrollToBeginning . scroller, the return type of the first function, r, is instantiated to a polymorphic type forall s. EventM n s (). I think this requires impredicative polymorphism. To fix that, we could either enable ImpredicativeTypes or eta expand the function to remove .. Given that ImpredicativeTypes is flaky before GHC 9.2, I just use eta expansion. BTW the original code compiles on GHC 9.2 even without ImpredicativeTypes enabled. Please correct me If I missed anything.
Currently the compilation fails on GHC 9.0:
Consider the following functions:
In
vScrollToBeginning . scroller
, the return type of the first function,r
, is instantiated to a polymorphic typeforall s. EventM n s ()
. I think this requires impredicative polymorphism. To fix that, we could either enableImpredicativeTypes
or eta expand the function to remove.
. Given thatImpredicativeTypes
is flaky before GHC 9.2, I just use eta expansion. BTW the original code compiles on GHC 9.2 even withoutImpredicativeTypes
enabled. Please correct me If I missed anything.