Dynamic Map

2005-10-16 Thread Lajos Nagy
Hi, Would it be possible to implement a Map in Haskell that, when asked for a key it doesn't have, would return a 'fresh' (meaning: not in the Map already) value, and afterwards it would consistently return the same value for the given key. In other words, it would behave like a dynamic map

GHC build failure

2005-10-16 Thread Krasimir Angelov
When I am trying to build GHC from CVS it fails with: deSugar/DsMeta.hs:288:13: Constructor `ConDecl' should have 6 arguments, but has been given 4 When checking the pattern: ConDecl con [] (L _ []) details When checking the pattern: L loc (ConDecl con [] (L _ []) details) In the

[Haskell] reader-like IO, parents of threads

2005-10-16 Thread Frederik Eaton
Hi, I'm trying to get MonadReader-like functionality in the IO monad. It doesn't appear possible implement it with the interfaces that Haskell98 or GHC provide. I'm looking for something like thread-local variables. The interface could be something like this: newTLRef :: a - IO (TLRef a)

Re: [Haskell] reader-like IO, parents of threads

2005-10-16 Thread Frederik Eaton
John Meacham suggested that I should be a little more clear about the semantics I'm seeking. Also, apparently it isn't possible to implement writeTLRef/modifyTLRef with the data structure I gave: data TLRef a = TLR a (MVar (Map ThreadId a)) (the first argument is a default value, the second is a

Re[2]: [Haskell-cafe] Estonia and GADT

2005-10-16 Thread Bulat Ziganshin
Hello David, Saturday, October 15, 2005, 9:38:58 PM, you wrote: DR darcs get http://abridgegame.org/darcs-patch-theory Invalid repository: http://abridgegame.org/darcs-patch-theory darcs failed: Failed to download URL http://abridgegame.org/darcs-patch-theory/_darcs/inventory libcurl: HTTP

Re: Re[2]: [Haskell-cafe] Estonia and GADT

2005-10-16 Thread Peter Scott
On 10/16/05, Bulat Ziganshin [EMAIL PROTECTED] wrote: DR darcs get http://abridgegame.org/darcs-patch-theory Invalid repository: http://abridgegame.org/darcs-patch-theory [...] The link didn't work for me either, but this is what you're looking for:

Re: [Haskell-cafe] Estonia and GADT

2005-10-16 Thread David Roundy
On Sun, Oct 16, 2005 at 12:48:28PM +0400, Bulat Ziganshin wrote: btw, from where yourself studied what is GADT and how it can be used? I read Simons' paper on GADTs and didn't understand from that how it could be used for anything other than ASTs and interpereters. Most of what I know about

Re: [Haskell-cafe] Newbie question on Haskell type

2005-10-16 Thread Huong Nguyen
Thanks all of your for your time and your interesting examples. Now I can see that my problem is parsing a String. I am new in Haskell, so, I start to study parsing and how to create a parser from beginning. I start with an example from the book as follows: %The parser item fails if the input is

[Haskell-cafe] Generic parser without GADTs

2005-10-16 Thread oleg
Also inspired by Ralf Hinze's post, I thought of removing GADTs from that code. The result is Haskell98! code, which works well in Hugs. The code seems to be a bit simpler too. Like the original code, the function 'parseAny' correctly discriminates between the list of characters (i.e., strings)

Re: [Haskell-cafe] Generic parser without GADTs

2005-10-16 Thread Huong Nguyen
Hi all, You are talking about parsing and data type, so I want to ask you a question relating to my data type. I have a data types and a function as follows: \begin{code} data Type a = C1 { x :: [String] ,y :: Type a} | C2 {x1 :: String} | C3 {y1 :: Bool} deriving Show showType ::

Re: [Haskell-cafe] Newbie question on Haskell type

2005-10-16 Thread Albert Lai
Huong Nguyen [EMAIL PROTECTED] writes: newtype Parser a = Parser(String - [(a, String)]) [...] parse :: Parser a - String - [(a, String)] parse p cs = p cs \end{code} Try this instead: parse (Parser p) cs = p cs (You forgot to deconstruct! :) )