Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Strange new Haskell Platform (Corentin Dupont)


----------------------------------------------------------------------

Message: 1
Date: Thu, 20 Sep 2012 11:04:34 +0200
From: Corentin Dupont <[email protected]>
Subject: Re: [Haskell-beginners] Strange new Haskell Platform
To: bucephalus org <[email protected]>
Cc: [email protected]
Message-ID:
        <CAEyhvmpvMCY_O=fyqcl7hfbpqg73zpwbqbbjd7bbp9nuknj...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

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
<[email protected]>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-2.0.0.1'
>   ...
> 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?
>
>
see
http://stackoverflow.com/questions/7438600/datatypecontexts-deprecated-in-latest-ghc-why
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)

Best,
Corentin


> Cheers,
> Tom
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> 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-0001.htm>

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 51, Issue 31
*****************************************

Reply via email to