RE: ghc feature request: core notes
Hal,
OK. If you want to change CoreSyn.Note to have an extra constructor,
thus:
data Note = SCC CostCentre
| Coerce Type Type
| InlineMe
| InlineCall
| NoteString String -- NEW
and check that the rest of the compiler does something sensible with
NoteString, I do not object. There are only 12 lines of the compiler
than mention InlineCall, for example, so I expect NoteString would be
similarly low-impact.
[Incidentally, InlineCall is an undocumented feature. You can write
inline f x
to mean the same as (f x), except that this particular call to f will be
inlined.]
Simon
| -----Original Message-----
| From: Alastair Reid [mailto:alastair@reid-consulting-uk.ltd.uk]
| Sent: 06 February 2003 11:28
| To: Simon Peyton-Jones
| Cc: Hal Daume III; GHC Users Mailing List
| Subject: Re: ghc feature request: core notes
|
|
| "Hal Daume III"
Hi, when toying around with GHCi, I got a bunch of Prelude> :r phase `Literate pre-processor' failed (exitcode = 1) Prelude> :l Hist phase `Literate pre-processor' failed (exitcode = 1) ghc -c -Wall didn't find anything suspicious, and in the end, exiting and restarting ghci did the trick. I've no idea what trigged this, perhaps running out of file handles? Just in case you'd like to know, -kzm -- If I haven't seen further, it is by standing in the footprints of giants
ketil@ii.uib.no (Ketil Z. Malde) writes: ketil@ii.uib.no (Ketil Z. Malde) writes:
Prelude> :r phase `Literate pre-processor' failed (exitcode = 1)
I've no idea what trigged this, perhaps running out of file handles?
I forgot: GHC version 5.04.1. It seems that this is definitely trigged by running out of file handles, so apparently, I did have an idea. ==== The following code runs out of file handles, so I am seeking enlightenment as to why.
-- | add data from a file to the histogram addFile :: FiniteMap String Int -> String -> IO (FiniteMap String Int) addFile fm name = do x <- readFile name return (addHist fm x)
-- | add data from all files in a directory to the histogram addDir :: FiniteMap String Int -> String -> IO (FiniteMap String Int) addDir fm dir = do dc <- getDirectoryContents dir fs <- filterM doesFileExist (map ((dir++"/")++) dc) foldM addFile fm fs
Running addDir on a directory with few hundred files trigs it. Shouldn't all of each file's contents be consumed by each addFile, and thus the handle be released? -kzm -- If I haven't seen further, it is by standing in the footprints of giants
I appreciate this may have been covered before, but i'm struggling to get the types right for the following functions: firstly I have a function I want to be passed an MArray (so the function itself is polymorphic and independant of the type of array used). This has a type similar to: fn1 :: MArray a Int m => a (Int,Int) Int -> m () now I want to produce a wrapper function to provide an MArray of a given type, and freeze the result into a non-mutable array, so I have a function like: wrapper :: MArray (STUArray s) Int (ST s) => ST s (Array (Int,Int) Int) wrapper = do d <- newArray ((0,0),(10,10)) 0 fn1 d unsafeFreeze d However the problem comes when I try and use runST to run it... runMatrix :: Array (Int,Int) Int runMatrix = runST $ wrapper This is becase 's' escapes Expected: ST s a -> b Inferred: (forall s1. ST s1 a) -> a where am I going wrong? Regards, Keean Schupke.
participants (3)
-
Keean -
ketil@ii.uib.no -
Simon Peyton-Jones