newtype Seg = Seg Int Intnewtype Pos = Pos Int Int f::Bool->Seg->Intf a (Seg c d) = if a then c else d f1::Pos->Intf1 (Pos a b) = f True $ Seg(a,b) main = print $ f1 $ Pos(4,5)
Standard input is empty
[1 of 1] Compiling Main ( prog.hs, prog.o ) prog.hs:2:14: The constructor of a newtype must have exactly one field but `Pos' has two In the definition of data constructor `Pos' In the newtype declaration for `Pos'
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!