fork download
  1. newtype Seg = Seg Int Int
  2. newtype Pos = Pos Int Int
  3.  
  4. f::Bool->Seg->Int
  5. f a (Seg c d) = if a then c else d
  6.  
  7. f1::Pos->Int
  8. f1 (Pos a b) = f True $ Seg(a,b)
  9.  
  10. main = print $ f1 $ Pos(4,5)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[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'
stdout
Standard output is empty