Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread Ivan Miljenovic
On 28 July 2010 14:07, aditya siram  wrote:
> I didn't realize the State monad wasn't part of the base install. Any
> particular reason for this?

Because there's no reason for it to be?  GHC is bundled with enough
libraries as it is (and with the exception of Cabal, it's not safe to
upgrade any of them).

However, mtl _is_ part of the Haskell Platform, so in that sense it's
part of the _recommended_ base install...

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread aditya siram
I didn't realize the State monad wasn't part of the base install. Any
particular reason for this?
-deech

On Tue, Jul 27, 2010 at 10:24 PM, Ivan Miljenovic  wrote:

> On 28 July 2010 13:17, michael rice  wrote:
> >
> > See below. Lot's of warnings. Is the install OK? If so, can I use the
> same *import*?
>
> Yeah, the install is OK.  The meaning of the warnings are:
>
> * "Warning: -fallow-undecidable-instances is deprecated:" this GHC
> option has changed name, but the mtl package still uses the old name.
>
> * "Warning: Module `Prelude' is deprecated:" mtl doesn't specify any
> bounds on the version of the base library to be used (mainly because
> of historic reasons when it wasn't changing much and the Haskell
> community wasn't stressing versioning as much; note that the last
> version of mtl was released almost 2 years ago).  Because a lot of
> packages broke when GHC-6.10.4 started shipping with base-4 (along
> with base-3 for compatability purposes) due to the differences in how
> exceptions were handled, if there is no upper bound on the version of
> base to be used then cabal-install plays it safe and uses base-3.
> However, the next version of GHC (6.14, which should be coming out
> later this year) will not ship with base-3, so GHC-6.12 included that
> warning message for people that kept trying to use base-3 that their
> code won't work with 6.14.
>
> So yes, now you can use "import Control.Monad.State".
>
> >
> > Michael
> >
> > --- On Tue, 7/27/10, Ivan Miljenovic  wrote:
> >
> > >
> > > If it isn't installed, you can use cabal-install to install it:
> > >
> > > cabal install mtl
> > >
> > > --
> > > Ivan Lazar Miljenovic
> > > ivan.miljeno...@gmail.com
> > > IvanMiljenovic.wordpress.com
> > >
> >
> >
> > [mich...@localhost ~]$ cabal install mtl
> > Resolving dependencies...
> > Downloading mtl-1.1.0.2...
> > Configuring mtl-1.1.0.2...
> > Preprocessing library mtl-1.1.0.2...
> > Building mtl-1.1.0.2...
> > [ 1 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs,
> dist/build/Control/Monad/Identity.o )
> >
> > Control/Monad/Cont.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Cont/Class.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Error.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Error/Class.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Identity.hs:1:0:
> > Warning: Module `Prelude' is deprecated:
> >You are using the old package `base' version 3.x.
> >Future GHC versions will not support base version 3.x. You
> >should update your code to use the new base version 4.x.
> >
> > Control/Monad/List.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/RWS/Lazy.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/RWS/Strict.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Reader.hs:2:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Reader/Class.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/State/Lazy.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/State/Strict.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Writer.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Writer/Class.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-}
> instead
> >
> > Control/Monad/Writer/Lazy.hs:1:11:
> > Warning: -fallow-undecidable-instances is deprecated: use
> -XUndecidableInstances or pragma {-# LANGUAGE 

Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread Ivan Miljenovic
On 28 July 2010 13:17, michael rice  wrote:
>
> See below. Lot's of warnings. Is the install OK? If so, can I use the same 
> *import*?

Yeah, the install is OK.  The meaning of the warnings are:

* "Warning: -fallow-undecidable-instances is deprecated:" this GHC
option has changed name, but the mtl package still uses the old name.

* "Warning: Module `Prelude' is deprecated:" mtl doesn't specify any
bounds on the version of the base library to be used (mainly because
of historic reasons when it wasn't changing much and the Haskell
community wasn't stressing versioning as much; note that the last
version of mtl was released almost 2 years ago).  Because a lot of
packages broke when GHC-6.10.4 started shipping with base-4 (along
with base-3 for compatability purposes) due to the differences in how
exceptions were handled, if there is no upper bound on the version of
base to be used then cabal-install plays it safe and uses base-3.
However, the next version of GHC (6.14, which should be coming out
later this year) will not ship with base-3, so GHC-6.12 included that
warning message for people that kept trying to use base-3 that their
code won't work with 6.14.

So yes, now you can use "import Control.Monad.State".

>
> Michael
>
> --- On Tue, 7/27/10, Ivan Miljenovic  wrote:
>
> >
> > If it isn't installed, you can use cabal-install to install it:
> >
> > cabal install mtl
> >
> > --
> > Ivan Lazar Miljenovic
> > ivan.miljeno...@gmail.com
> > IvanMiljenovic.wordpress.com
> >
>
>
> [mich...@localhost ~]$ cabal install mtl
> Resolving dependencies...
> Downloading mtl-1.1.0.2...
> Configuring mtl-1.1.0.2...
> Preprocessing library mtl-1.1.0.2...
> Building mtl-1.1.0.2...
> [ 1 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, 
> dist/build/Control/Monad/Identity.o )
>
> Control/Monad/Cont.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Cont/Class.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Error.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Error/Class.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Identity.hs:1:0:
>     Warning: Module `Prelude' is deprecated:
>    You are using the old package `base' version 3.x.
>    Future GHC versions will not support base version 3.x. You
>    should update your code to use the new base version 4.x.
>
> Control/Monad/List.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/RWS/Lazy.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/RWS/Strict.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Reader.hs:2:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Reader/Class.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/State/Lazy.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/State/Strict.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Writer.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Writer/Class.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Writer/Lazy.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
>
> Control/Monad/Writer/Strict.hs:1:11:
>     Warning: -fallow-undecidable-instances is deprecated: use 
> -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
> [ 2 of 21] Compiling Control.Monad.Writer.Class ( 
> Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o )
>
> Control/Mona

Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread michael rice
See below. Lot's of warnings. Is the install OK? If so, can I use the same 
*import*?

Michael

--- On Tue, 7/27/10, Ivan Miljenovic  wrote:

>
> If it isn't installed, you can use cabal-install to install it:
>
> cabal install mtl
>
> --
> Ivan Lazar Miljenovic
> ivan.miljeno...@gmail.com
> IvanMiljenovic.wordpress.com
>


[mich...@localhost ~]$ cabal install mtl
Resolving dependencies...
Downloading mtl-1.1.0.2...
Configuring mtl-1.1.0.2...
Preprocessing library mtl-1.1.0.2...
Building mtl-1.1.0.2...
[ 1 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, 
dist/build/Control/Monad/Identity.o )

Control/Monad/Cont.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Cont/Class.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Error.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Error/Class.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Identity.hs:1:0:
    Warning: Module `Prelude' is deprecated:
   You are using the old package `base' version 3.x.
   Future GHC versions will not support base version 3.x. You
   should update your code to use the new base version 4.x.

Control/Monad/List.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/RWS/Lazy.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/RWS/Strict.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Reader.hs:2:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Reader/Class.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/State/Lazy.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/State/Strict.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Writer.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Writer/Class.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Writer/Lazy.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead

Control/Monad/Writer/Strict.hs:1:11:
    Warning: -fallow-undecidable-instances is deprecated: use 
-XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances #-} instead
[ 2 of 21] Compiling Control.Monad.Writer.Class ( 
Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o )

Control/Monad/Writer/Class.hs:1:0:
    Warning: Module `Prelude' is deprecated:
   You are using the old package `base' version 3.x.
   Future GHC versions will not support base version 3.x. You
   should update your code to use the new base version 4.x.
[ 3 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs, 
dist/build/Control/Monad/Error/Class.o )

Control/Monad/Error/Class.hs:1:0:
    Warning: Module `Prelude' is deprecated:
   You are using the old package `base' version 3.x.
   Future GHC versions will not support base version 3.x. You
   should update your code to use the new base version 4.x.
[ 4 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs, 
dist/build/Control/Monad/State/Class.o )

Control/Monad/State/Class.hs:1:0:
    Warning: Module `Prelude' is deprecated:
   You are using the old package `base' version 3.x.
   Future GHC versions will not support base version 3.x. You
   should update your code to use the new base version 4.x.
[ 5 of 21] Compiling Control.Monad.Reader.Class ( 
Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o )

Control/Monad/Reader/Class.hs:1:0:
    Warning: Module `Prelude' is deprecated:
   

Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread Felipe Lessa
On Wed, Jul 28, 2010 at 12:04 AM, Ivan Miljenovic
 wrote:
> On 28 July 2010 13:03, michael rice  wrote:
>>
>> [mich...@localhost ~]$ ghc-pkg list mtl
>> /usr/lib/ghc-6.12.1/package.conf.d
>> [mich...@localhost ~]$
>>
>> Installed?
>
> No; if it was installed it would specify a version.

For example:

$ ghc-pkg list mtl
/usr/lib64/ghc-6.12.3/package.conf.d
   mtl-1.1.0.2

-- 
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread Ivan Miljenovic
On 28 July 2010 13:03, michael rice  wrote:
>
> [mich...@localhost ~]$ ghc-pkg list mtl
> /usr/lib/ghc-6.12.1/package.conf.d
> [mich...@localhost ~]$
>
> Installed?

No; if it was installed it would specify a version.

>
> Michael
>
> --- On Tue, 7/27/10, Ivan Miljenovic  wrote:
>
> From: Ivan Miljenovic 
> Subject: Re: [Haskell-cafe] Need Control.Monad.State
> To: "michael rice" 
> Cc: haskell-cafe@haskell.org
> Date: Tuesday, July 27, 2010, 10:51 PM
>
> On 28 July 2010 12:39, michael rice  wrote:
> >
> > How do I import Control.Monad.State?
>
> Install and use the mtl library (comes with the Haskell platform),
> monads-fd (almost identical API to mtl; the point of this is that mtl
> uses some extension: the non-extension bits are in the transformers
> library and monads-fd extends transformers by using extensions to
> implement mtl functionality) or monads-tf (a different approach to
> what monads-fd does using different extensions).
>
> To check if you have mtl installed (substitute the other package names
> if necessary):
>
> ghc-pkg list mtl
>
> If it isn't installed, you can use cabal-install to install it:
>
> cabal install mtl
>
> --
> Ivan Lazar Miljenovic
> ivan.miljeno...@gmail.com
> IvanMiljenovic.wordpress.com
>



--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread michael rice
[mich...@localhost ~]$ ghc-pkg list mtl
/usr/lib/ghc-6.12.1/package.conf.d
[mich...@localhost ~]$ 

Installed?

Michael

--- On Tue, 7/27/10, Ivan Miljenovic  wrote:

From: Ivan Miljenovic 
Subject: Re: [Haskell-cafe] Need Control.Monad.State
To: "michael rice" 
Cc: haskell-cafe@haskell.org
Date: Tuesday, July 27, 2010, 10:51 PM

On 28 July 2010 12:39, michael rice  wrote:
>
> How do I import Control.Monad.State?

Install and use the mtl library (comes with the Haskell platform),
monads-fd (almost identical API to mtl; the point of this is that mtl
uses some extension: the non-extension bits are in the transformers
library and monads-fd extends transformers by using extensions to
implement mtl functionality) or monads-tf (a different approach to
what monads-fd does using different extensions).

To check if you have mtl installed (substitute the other package names
if necessary):

ghc-pkg list mtl

If it isn't installed, you can use cabal-install to install it:

cabal install mtl

--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com



  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread Ivan Miljenovic
On 28 July 2010 12:39, michael rice  wrote:
>
> How do I import Control.Monad.State?

Install and use the mtl library (comes with the Haskell platform),
monads-fd (almost identical API to mtl; the point of this is that mtl
uses some extension: the non-extension bits are in the transformers
library and monads-fd extends transformers by using extensions to
implement mtl functionality) or monads-tf (a different approach to
what monads-fd does using different extensions).

To check if you have mtl installed (substitute the other package names
if necessary):

ghc-pkg list mtl

If it isn't installed, you can use cabal-install to install it:

cabal install mtl

--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Need Control.Monad.State

2010-07-27 Thread michael rice
How do I import Control.Monad.State?

I see this note in 
http://en.wikibooks.org/wiki/Haskell/Understanding_monads/State
 
Note: in some package systems used for GHC, the Control.Monad.State module is 
in a separate package, usually indicated by MTL (Monad Transformer Library).

Michael


===rand.hs ==

import Control.Monad.State

type GeneratorState = State StdGen

rollDie :: GeneratorState Int
rollDie = do generator <- get
 let( value, newGenerator ) = randomR (1,6) generator
 put newGenerator
 return value

===

[mich...@localhost ~]$ ghci rand
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.

rand.hs:1:7:
    Could not find module `Control.Monad.State':
  Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Prelude>




  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe