[Haskell-cafe] Hood on Hackage is an interesting way to see
intermediate data structures.
caseyh at istar.ca
caseyh at istar.ca
Mon Nov 15 15:07:03 EST 2010
Hood on Hackage is an interesting way to see intermediate data structures.
{-# LANGUAGE NoMonomorphismRestriction #-}
-- Fold Behaviour Observed
module Folding where
-- See Hood on Hackage
import Observe
import Data.List
n = 10::Int
fr = foldr (observe "Add" (+)) 0 [1..n]
fl = foldl (observe "Add" (+)) 0 [1..n]
frr = foldr (observe "Add" (+)) 0 (reverse [1..n])
flr = foldl (observe "Add" (+)) 0 (reverse [1..n])
fro = printO fr
flo = printO fl
frro = printO frr
flro = printO flr
fl' = foldl' (observe "Add" (+)) 0 [1..n]
flr' = foldl' (observe "Add" (+)) 0 (reverse [1..n])
flo' = printO fl'
flro' = printO flr'
More information about the Haskell-Cafe
mailing list