blob: 2db86003896b0caf5fda9cf150f378b70d7df1f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
{-# 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)
|