data Pill a where
Stop :: Pill Integer
O :: Pill (Pill a -> a)
collect :: Integer -> Pill a -> a
collect i Stop = i
collect i O = collect (i+1)
start = collect 0
-- > start Stop
-- 0
-- > start O Stop
-- 1
-- > start O O Stop
-- 2
-- > start O O O Stop
-- 3
-- > start O O O O Stop
-- 4
-- > start O O O O O Stop
-- 5
Saturday, 15 November 2008
Variadic via GADT
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment