Commit df3adad5 authored by cmcq's avatar cmcq
Browse files

Test derived Foldable instance

parent 333d197d
......@@ -34,3 +34,7 @@ test('drvrun-functor1',
if_compiler_lt('ghc', '6.11', expect_fail),
compile_and_run,
[''])
test('drvrun-foldable1',
if_compiler_lt('ghc', '6.11', expect_fail),
compile_and_run,
[''])
{-# LANGUAGE DeriveFunctor, DeriveFoldable #-}
module Main where
import Prelude hiding (sum)
import Data.Foldable
-- Derive Foldable for a simple data type
data List a = Nil | Cons a (List a)
deriving (Functor,Foldable,Show)
someList = Cons 1 (Cons 1 (Cons 2 (Cons 3 Nil)))
main = print (sum someList)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment