[Haskell-beginners] applicative instance

Francesco Ariis fa-ml at ariis.it
Fri Jan 27 22:21:35 UTC 2017


On Fri, Jan 27, 2017 at 11:09:07PM +0100, sasa bogicevic wrote:
> What is wrong with my applicative instance for custom List type ?
> 
> http://lpaste.net/351723
> 
> [..]

You have implemented <*> on a list in one of the many possible
(and sensible) ways. In regular Haskell it's a ZipList

    λ> :m Control.Applicative
    λ> ZipList [(+1), (*2)] <*> ZipList [1,2]
    ZipList {getZipList = [2,4]}

(and there's nothing wrong with that)


More information about the Beginners mailing list