[Haskell-beginners] Strange new Haskell Platform
Chaddaï Fouché
chaddai.fouche at gmail.com
Thu Sep 20 10:58:14 CEST 2012
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.
>
That's because your reinstalled Haskell Platform is more recent than your
old one, it brings a new version of GHC (7.4.1 probably) and this version
has moved from Haskell 98 to Haskell 2010 for its defaults.
>
>
> 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?
>
>
Haskell 2010 makes official the move from the old flat module namespace to
the semi-hierarchical modules names so what used to be in System is now in
System.Environment/Exit/.. you usually only need one. If you still want to
use the old Haskell98 modules, you can expose the package haskell98 (which
you do by adding "-package haskell98" to the command line or adding the
package in the .cabal file)
>
> 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?
>
>
Basically the context in "data (Show n, Show v, Ord n, Ord v) => Automaton
n v" don't do what one would typically want it to do, that is it doesn't
add it implicitly in functions that use the Automaton type, you have to do
that yourself. So the Haskell committee decided to deprecate this
misleading possibility, most people would do fine without (eventually
documenting the expectations in an Haddock comment) or use GADTs instead
that really works for those kind of things. So either you delete this (Show
n...) context (moving it to documentation) which shouldn't have any effect
on your program (major reason for this deprecation) or you just ignore the
deprecation warning (it's just a warning after all).
It's a brand new world ! And to compensate for those little problems, this
new GHC probably compiles faster programs than your old one and offer some
interesting new capacities (see the release notes).
--
Jedaï
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120920/c53f12a0/attachment-0001.htm>
More information about the Beginners
mailing list