Skip to content

Conversation

@ysangkok
Copy link
Contributor

I haven't added all the alternatives with mempty and empty as hlint doesn't
know about types, and there could be lawless instances out there I suppose. So
it's safer just to deal with concrete types.

ghci> :{
ghci| let f :: Applicative m => m (b -> (Int, b))
ghci|     f = (,) <$> pure 5
ghci| :}
ghci> f <*> mempty :: Ap [] (Int, Sum Int)
Ap {getAp = [(5,Sum {getSum = 0})]}
ghci> f <*> empty :: Ap [] (Int, Sum Int)
Ap {getAp = []}

Would be nice to detect the last one, but hlint can't know that it's empty on Ap [] (..., Sum ...).

@ndmitchell ndmitchell merged commit 6035a13 into ndmitchell:master Oct 20, 2024
0 of 5 checks passed
@ndmitchell
Copy link
Owner

Thanks!

@ysangkok ysangkok deleted the applicative-rhs branch October 21, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants