Re: Beginners Digest, Vol 122, Issue 6

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Beginners Digest, Vol 122, Issue 6

Anthony Lee
The source code is here: https://github.com/ekmett/bound/

On Fri, Aug 17, 2018 at 8:41 AM <[hidden email]> wrote:
Send Beginners mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Bound library questions (Anthony Lee)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 Aug 2018 06:46:52 -0400
From: Anthony Lee <[hidden email]>
To: [hidden email]
Subject: [Haskell-beginners] Bound library questions
Message-ID:
        <CA+pBo5HVraf_8jbs15bR6QAy1S7=z_u-3KBwT=[hidden email]>
Content-Type: text/plain; charset="utf-8"

In Scope.hs there are some functions I feel difficult to understand,
Why fmap/foldmap/traverse is applied three times?

instance Functor f => Functor (Scope b f) where
fmap f (Scope a) = Scope (fmap (fmap (fmap f)) a)
{-# INLINE fmap #-}

-- | @'toList'@ is provides a list (with duplicates) of the free variables
instance Foldable f => Foldable (Scope b f) where
foldMap f (Scope a) = foldMap (foldMap (foldMap f)) a
{-# INLINE foldMap #-}

instance Traversable f => Traversable (Scope b f) where
traverse f (Scope a) = Scope <$> traverse (traverse (traverse f)) a
{-# INLINE traverse #-}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180817/429114c8/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 122, Issue 6
*****************************************

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners