Re: Global variables

2001-11-29 Thread Ashley Yakeley
At 2001-11-29 11:13, Ashley Yakeley wrote: >Lifted monads look something like this: > > data MyAction a = MkMyAction ((consts,vars) -> (vars,a)); > instance Monad MyAction where etc. Whoops, should be data MyAction a = MkMyAction ((consts,vars) -> IO (vars,a)); -- Ashley Yakeley

Re: Global variables

2001-11-29 Thread Ashley Yakeley
At 2001-11-29 05:31, Juan Ignacio García García wrote: >I am interested in using global variables (in GHC). In JVM-Bridge (nearly there!) I use lifted monads to store global constants, though variables are not hard either. This does mean an extra function needed to call IO functions, but in my c

Re: Global variables

2001-11-29 Thread C.Reinke
> Hello, I am interested in using global variables (in GHC). I need a > variable to store list of Integers to store temporary results. I > have been reading the module MVar, but I wonder if there is an > alternative way of doing it. I have already implemented my function > using an auxiliar ar

Re: Where to ask questions regarding categories and datatypes

2001-11-29 Thread C.Reinke
> Peter Douglass writes: > > Hi, > > I have a number of questions regarding categories and datatypes. I know > > that many of the folk in this mailing list could answer these question, but > > I wonder if there is a more appropriate forum. (i.e. the question are not > > Haskell specific).

Re: Global variables

2001-11-29 Thread Alastair David Reid
> Hello, I am interested in using global variables (in GHC). I need a > variable to store list of Integers to store temporary results. I > have been reading the module MVar, but I wonder if there is an > alternative way of doing it. I have already implemented my function > using an auxiliar ar

Re: Possible bug/omission in Numeric library?

2001-11-29 Thread Alastair David Reid
> Also, GHC's NumExts has > doubleToFloat :: Double -> Float > floatToDouble :: Float -> Double > Q2: If we are going to run round adding functions to Numeric, > should we add those too? It's hard to know where to stop... but if > that conversion is what you want to do, H98 doesn't give

Confused about Random

2001-11-29 Thread Ian Lynagh
With the following module: module Main where import Random data Foo = Foo StdGen main :: IO() main = do let rs = randoms (Foo (mkStdGen 39)) :: [Int] rRs = randomRs (0,9) (Foo (mkStdGen 39)) :: [Int] putStrLn $ show $ take 100 rs

Re: Global variables

2001-11-29 Thread Dmitry Astapov
JIGG> alternative way of doing it. I have already implemented my function JIGG> using an auxiliar argument where I put my lists of Integers. Will JIGG> the use of a global variable improve my function? There is no such thing as mutable variable (as in imperative languages) in Haskell (and m

Re: Possible bug/omission in Numeric library?

2001-11-29 Thread Malcolm Wallace
> As you say, we can't change the type of showInt. I suppose we could > add: > > showIntAtBase :: Integral a=20 > =3D> a-- base > -> (a -> Char) -- digit to char > -> a-- number to show. > -> ShowS > > showOct, showHex ::

Global variables

2001-11-29 Thread Juan Ignacio García García
Hello, I am interested in using global variables (in GHC). I need a variable to store list of Integers to store temporary results. I have been reading the module MVar, but I wonder if there is an alternative way of doing it. I have already implemented my function using an auxiliar argument where

RE: Possible bug/omission in Numeric library?

2001-11-29 Thread Simon Peyton-Jones
| However, I would guess that changing the type signature of | the current showInt function is unacceptable for Haskell'98. | Maybe we should consider adding the more general version | under a new name like showIntBase, together with | show{Dec,Oct,Hex}? This would break no existing code, an

RE: IO errors

2001-11-29 Thread Simon Peyton-Jones
| Two possibilities: either createDirectory should act like | 'mkdir -p' and make the whole path, or the library report | should document isDoesNotExistError as a possible error | thrown by createDirectory. I'd vote for the latter. I'm willing to do that for H98 unless anyone can think of a r

RE: IO errors

2001-11-29 Thread Simon Marlow
> A quick look at the source looks like both GHC and NHC will > simply pass > on errors from the OS, so for example with > > module Main where > > import IO > import Directory > > main :: IO() > main = do catch (createDirectory "this/does/not/exist/foo") >