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
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
> 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
> 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).
> 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
> 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
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
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
> 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 ::
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
| 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
| 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
> 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")
>
13 matches
Mail list logo