-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
The general recommendation seems to be to place pragmas after the entity they apply to. But in case of the {-# MINIMAL #-} pragma, I think the following works best in terms of readability:
class Foldable t where
{-# MINIMAL foldMap | foldr #-}
-- | Combine the elements of a structure using a monoid.
fold :: Monoid m => t m -> m
fold = foldMap id
{- long list of other methods -}
-- | List of elements of a structure.
toList :: Foldable t => t a -> [a]
toList t = build (\ c n -> foldr c n t)
{-# INLINE toList #-}as opposed to place the {-# MINIMAL #-}-line after the {-# INLINE toList #-}-line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels