Re: [Haskell-beginners] Beginners Digest, Vol 122, Issue 6

The source code is here: https://github.com/ekmett/bound/
On Fri, Aug 17, 2018 at 8:41 AM
Send Beginners mailing list submissions to beginners@haskell.org
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 beginners-request@haskell.org
You can reach the person managing the list at beginners-owner@haskell.org
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
To: beginners@haskell.org Subject: [Haskell-beginners] Bound library questions Message-ID: 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 #-}
participants (1)
-
Anthony Lee