Hi! I just finished reading the "Man or Boy" post and wished to make
the example Haskell program a bit briefer with the following change:
yo :: Integer -> [S s] -> S s
yo k (x1:x2:x3:x4:x5:[]) = a k x1 x2 x3 x4 x5
and with that the new run is
run' k = runST (yo k (map return [1 (-1) (-1) 1 0]))
(instead of the original where the list argument is laid out as
curried individuals).
where type S s = ST s Integer
-----
The compiler complains that:
No instance for (Num (a -> a1 -> t -> t1 -> Integer))
arising from the literal `1'
at /Users/dauclair/projects/haskell/eclipse/Tasty/src/
ManOrBoy.hs:25:34-48
Possible fix:
add an instance declaration for
(Num (a -> a1 -> t -> t1 -> Integer))
In the expression: 1 (- 1) (- 1) 1 0
In the second argument of `map', namely `[1 (- 1) (- 1) 1 0]'
In the second argument of `yo', namely
`(map return [1 (- 1) (- 1) 1 0])'
-----
So, how is it that a list of the lifted integers is different than
individually lifted integers, type-wise? How can the list elements be
properly lifted to their stateful equivalents? I'm using ghc-6.6.1
Sincerely,
Doug Auclair