[clean-list] constant Tree as pattern ?
Dijken, Koen van
kdijken@tdn.nl
Mon, 31 Mar 2003 12:24:40 +0200
Hello,
I am a newcomer to Clean, and have the following question (Clean 2.0.2)
about the following piece of code:
:: Tree a = nil | Node a (Tree a) (Tree a)
test :: (Tree Int) -> Int
test (Node 1 nil nil) = 1
test (Node 2 nil nil) = 2
test = 3
Start = test (Node 1 nil nil)
compiles fine and gives 1 as the result of the Start function
When i replace Start with
Start = test (Node 2 nil nil)
however, i still get 1 as the result of Start when I expext 2 as the result.
>From the language report (chapter 3.2) I understand I can use any kind of
constant as a pattern. In my understanding of Clean at this moment the
expression (Node 2 nil nil) is a constant of type (Tree Int).
What is the flaw in my thinking ?
Koen van Dijken