Sirs/Mesdames:

We are considering a course using Haskell. We have "Hugs 98: Based on the
haskell 98 standard Copyright 1994-2001,"
downloaded just a few months ago. (This is under Windows NT.) The following
puzzles us --

>From the prelude:
        take 1 [ ]   --   expected to return the empty list [ ], instead
gives error message:
        ERROR - Cannot find "show" function for:
        ***  Expression : take 1 [ ]
        ***  Of type            : [a]

>From a module of ours with definition:
        -- select nth item from a list
        select :: Eq a => Int -> [a] -> [a]
        select n lis
           | n <= 0  ||  n > length lis = error "Invalid position!"
           | n == 1     = [head lis]
           | otherwise  = select (n-1) (tail lis)
when called thus:
        select  0  [ ]
Hugs gives the error message:
        ERROR - Unresolved overloading
        *** Type                : Eq a => [a]
        *** Expression  : select 0 [ ]

Surely Haskell should be able to just return [ ] in both cases.
Thanks ahead for your response.

Prof Ernest Paquet
Walsh University
2020 Easton St. N.W.
Canton, OH, 44720  (USA)

Phone   voice: 330-490-7229
        fax:    330-490-7165



_______________________________________________
Hugs-Bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/hugs-bugs

Reply via email to