[Haskell-beginners] applicative instance

sasa bogicevic brutallesale at gmail.com
Sat Jan 28 09:09:10 UTC 2017


Ok so how would the implementation look to get the correct result ?
I can't seem to write something that will compile except ZipList version.

Thanks, Sasa



> On Jan 27, 2017, at 23:21, Francesco Ariis <fa-ml at ariis.it> wrote:
> 
> 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)
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



More information about the Beginners mailing list