[Haskell-beginners] Strange new Haskell Platform

Corentin Dupont corentin.dupont at gmail.com
Thu Sep 20 11:04:34 CEST 2012

Hi Tom,
my 2 cents here:
it looks like you had an old version of GHC and now, it's a new!
My comments inline:

On Thu, Sep 20, 2012 at 10:18 AM, bucephalus org
<bucephalus.org at gmail.com>wrote:

> Dear fellow Haskellers,
> last weak my Linux machine broke down and refused to start again. I bought
> a new one and installed a fresh new KDE/Linux distribution (Mint/Ubuntu)
> and it looks and feels awesome. I also installed the Haskell platform via
> the default GUI installer (mintInstall).
> But when I try to run my recovered Haskell modules again, strange things
> happen.
> First of all, I have a module that has a line
>   import System
> and that used to be fine. But now, when I try to load the module in a ghci
> session, I get a complaint:
>   Could not find module 'System'
>   It is a member of the hidden package 'haskell98-'
>   ...
> The same happens if I do a
>   Prelude> :m System
> What is going on?

Most likely you wanted to import System.IO

> Secondly, I have another module that has a data type definition like this
>   data (Show n, Show v, Ord n, Ord v) => Automaton n v = Automaton {
>      nameSet :: Set.Set n,
>      valueSet :: Set.Set v,
>      ....
>   } deriving (Show, Eq, Ord)
> and that used to work fine, too. But now, I get the complaint
>   Illegal datatype context (use -XDatatypeContexts): (Show n, Show v, Ord
> n, Ord v) =>
> But when I follow the advice and start the module file with a
>   {-# LANGUAGE DatatypeContexts ... #-}
> I got the opposite complaint:
>   Warning: -XDatatypeContexts is depracated: It was widely considered a
> misfeature, and has been removed from the Haskell language.
> How can I clean this up?
Generally (my fellow haskeller may correct me) I think that's better to put
the class constraint on the methods rather than on the type declaration.
So it becomes:

data Automaton n v = Automaton {
     nameSet :: Set.Set n,
     valueSet :: Set.Set v
  } deriving (Show, Eq, Ord)

createAutomaton :: (Show n, Show v, Ord n, Ord v) => n -> v -> Automaton n v
createAutomaton n v = Automaton (singleton n) (singleton v)


> Cheers,
> Tom
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120920/ee839377/attachment.htm>

More information about the Beginners mailing list