hpastetwo

Problem with haskell types

author
anupam
age
40 days
language
haskell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
module Delme () where

data DecisionState = A | B | C | D

d_test :: Eq b => b -> b -> DecisionState -> DecisionState -> ()
d_test test testVal trueState falseState =
    if (test == testVal)
     then d trueState
     else d falseState

d :: DecisionState -> ()
d A = d_test True True B C
d B = d_test 1 2 C D
d C = d_test True False A B
d D = ()

retarded definition

author
roconnor
age
40 days
language
haskell
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
module Delme () where

data DecisionState = A | B | C | D

d_test :: Eq b => b -> b -> DecisionState -> DecisionState -> ()
d_test test testVal trueState falseState =
    if (test == testVal)
     then d (undefined `asTypeOf` test) trueState
     else d (undefined `asTypeOf` test) falseState

d :: Eq b => b -> DecisionState -> ()
d _ A = d_test True True B C
d _ B = d_test 1 2 C D
d _ C = d_test True False A B
d _ D = ()