You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
manyUnaryOp::MonadPlusf=>f (a->a) ->f (a->a)
manyUnaryOp f =foldr1(.)<$> some f
Data.Foldable ( foldr1 ) would be:
If we to use reludefoldr1 for that we would receive:
src/Nix/Parser.hs:609:32: error:
• Couldn't match type ‘[a -> a]’ with ‘a0 -> b0’
Expected type: f (a0 -> b0)
Actual type: f [a -> a]
• In the second argument of ‘(<$>)’, namely ‘some f’
In the expression: foldr1 (.) <$> some f
In an equation for ‘manyUnaryOp’:
manyUnaryOp f = foldr1 (.) <$> some f
• Relevant bindings include
f :: f (a -> a) (bound at src/Nix/Parser.hs:609:13)
manyUnaryOp :: f (a -> a) -> f (a -> a)
(bound at src/Nix/Parser.hs:609:1)
|
609 | manyUnaryOp f = foldr1 (.) <$> some f
| ^^^^^^
This is the only thing that was on the Relude side during migration. At first, I've with GHC thought that is some Skolem Existential thing, because was looking from the Relude function side.
But then, nope, Reludes foldr1 asks for a base case, while Foldable one is not.
The text was updated successfully, but these errors were encountered:
While migrating pretty big codebase (HNix) `foldr1` replacement is the only
place I tripped over and was puzzled a bit, the solution was simple, but harder
to see because difference was unexpected.
Since `relude` is very transparent in migration. It is good to document where
the API differences is, to guide people during migration and during use.
For more info:
kowainik#373kowainik#307 (comment)
HNix
is a pretty big project. And the migration torelude
went smooth, the migration took ~2d of work for everything, and also to debug this issue.https://github.com/haskell-nix/hnix/blob/cd02c6dd59105ccbfb36218fba3b0bce3c8c77ad/src/Nix/Parser.hs#L607-L608
Data.Foldable ( foldr1 )
would be:If we to use
relude
foldr1
for that we would receive:This is the only thing that was on the Relude side during migration. At first, I've with GHC thought that is some Skolem Existential thing, because was looking from the Relude function side.
But then, nope,
Relude
sfoldr1
asks for a base case, whileFoldable
one is not.The text was updated successfully, but these errors were encountered: