It is possible to derive syntax extensions where the constructors adhere by
arity but are not typeable:
$ cat test.omg
data Foo :: * where
Nu :: Foo
Co :: Int -> Int -> Foo
deriving List(f)
$ ./omega.exe test.omg
Omega Interpreter: version 1.4.6
Build Date: Fri May 7 10:18:58 Pacific Daylight Time 2010
Type ':?' for command line help.
Loading source files = ["test.omg"]
->Loading import test.omg
<-test.omg loaded.
prompt> [1,2]f
In the expression: Nu
the result type: Foo
was not what was expected: Int
truths:
different constants
Foo != Int
(Foo,Int)
prompt> []f
[]f : Foo
prompt> [1]f
In the expression: Nu
the result type: Foo
was not what was expected: Int
truths:
different constants
Foo != Int
(Foo,Int)
prompt> Co 1 2
omega.exe: Value.hs:(233,0)-(236,47): Non-exhaustive patterns in function
showVcon
As you can see from the transcript, type errors and even internal errors happen
when the constructors are malformed.
This should be pre-checked when "deriving" instead of accepted blindly.
Original issue reported on code.google.com by ggr...@gmail.com on 3 Dec 2010 at 4:51
Original issue reported on code.google.com by
ggr...@gmail.com
on 3 Dec 2010 at 4:51