diff --git a/bower.json b/bower.json index 9ceafb3..416481a 100644 --- a/bower.json +++ b/bower.json @@ -21,6 +21,7 @@ ], "dependencies": { "purescript-foldable-traversable": "^1.0.0-rc.1", + "purescript-generics": "^1.0.0-rc.1", "purescript-lazy": "^1.0.0-rc.1", "purescript-unfoldable": "^1.0.0-rc.1" }, diff --git a/src/Data/List.purs b/src/Data/List.purs index d0ae670..1d03412 100644 --- a/src/Data/List.purs +++ b/src/Data/List.purs @@ -94,6 +94,7 @@ import Control.MonadZero (class MonadZero) import Control.Plus (class Plus) import Data.Foldable (class Foldable, foldl, foldr, any) +import Data.Generic (class Generic) import Data.Maybe (Maybe(..)) import Data.Monoid (class Monoid, mempty) import Data.Traversable (class Traversable, traverse, sequence) @@ -689,6 +690,8 @@ foldM f a (Cons b bs) = f a b >>= \a' -> foldM f a' bs -- Instances ------------------------------------------------------------------- -------------------------------------------------------------------------------- +derive instance genericList :: Generic a => Generic (List a) + instance showList :: Show a => Show (List a) where show Nil = "Nil" show (Cons x xs) = "(Cons " <> show x <> " " <> show xs <> ")"