0

Strange error when attempting to load file into hugs:

Hugs> :l test.hs
ERROR "test.hs":3 - Undefined data constructor "?"

Full content of file (yes, one line):

test :: [a] -> ([a],[a])

Can anyone enlighten me?


Note: Attempting to load the same file in ghci doesn't work either, but for reasons that make sense:

Prelude> :r
[1 of 1] Compiling Main             ( test.hs, interpreted )

test.hs:1:1:
The type signature for ‘test’ lacks an accompanying binding
Failed, modules loaded: none.
AJF
  • 11,767
  • 2
  • 37
  • 64
abc32112
  • 2,457
  • 9
  • 37
  • 53
  • 5
    The hugs error is weird. ghci makes sense, you have only written a type signature for `test`, it needs a definition also, for example `test xs = (xs, xs)` (which is probably not what you were going for, but it will typecheck at least) – luqui Oct 27 '15 at 18:41
  • @luqui You should make your comment as an answer. – Sibi Oct 27 '15 at 19:32
  • 4
    Hugs hasn't been maintained since 2006 or so. Very few people use it any more, and you probably shouldn't either. – dfeuer Oct 27 '15 at 20:03
  • 2
    I'm going to make a totally unsubstantiated *guess* that your source code file starts with a Unicode byte-order-mark, which Hugs has no idea what the hell that is, and displays it as "?". – MathematicalOrchid Oct 27 '15 at 22:04
  • 1
    I installed hugs just to try to reproduce this excellent error message, but all I got was a boring `ERROR "test.hs":1 - Missing binding for variable "test" in type signature`. I suspect your file is not really just one line. (Or hugs is somehow reading uninitialized memory past the end of the file?) – Reid Barton Oct 28 '15 at 03:24
  • 1
    I see this has been basically answered, but what line is test on here? Line 3? or is line 3 the last line in your file? – Hamish Nov 11 '15 at 15:50

0 Answers0