escape from existential quantification

2003-02-27 Thread Wang Meng
I understand that existentially bound types cannot escape. For example, say we have data Foo = forall a. Foo Int a Then we cannot define a function extract (Foo i a) = a However,this limitation makes it extremly difficult to program with local quantifications.Is there any way to by pass this?

polymorphic type in state of state monad

2003-03-10 Thread Wang Meng
Hi All, Any one of your have the experience of defining a state of a state monad as a polymorphic type? I want to have: type State = Term a = [a] data M a = M (State - IO(State,a)) GHC yields a error message Illegal polymorphic type. How to resolve this? Thank you very much. -W-M- @ @

dynamics on polymorphic datatype

2003-07-25 Thread Wang Meng
Hi All, I am trying to perform dynamic casting on polymorphic types. Let's say I have a data type like: data Foo a = Foo a Is there any way to use dynamics to convert a value of type Foo a to a type reprentation? I try to use the toDyn in the dynamic libray, it complains for ambigours a. Is

Re: *safe* coerce, for regular and existential types

2003-08-01 Thread Wang Meng
I admire the elegancy of your code which makes the changes to add new data types minimum. There is one question I want to ask: Does this technique extend to polymophic types? Let's say we have the following type: data D a = C | D a Is it possible to index the type D a? Or there is some

constrained datatype

2004-01-14 Thread Wang Meng
Hi All, Anybody knows why the following code does not work? class Foo n data Erk n = Foo n = Erk test.hs:53: All of the type variables in the constraint `Foo n' are already in scope (at least one must be universally quantified here) When checking the existential context of

[Haskell] parser for Typing Haskell in Haskell

2004-11-17 Thread WANG Meng
Hi All, Does anybody know what parser Typing Haskell in Haskell use? I am tring to use the code for some type checking. But I cannot find a parser in the distribution. -W-M- @ @ | \_/ ___ Haskell mailing list [EMAIL PROTECTED]

[Haskell] build an interpreter on top of GHCi?

2005-01-26 Thread WANG Meng
Hi All, Does anybody has the experience to built an interpreter on top of GHCi? What I want is to defined a my own interpreter as a Haskell module and load it into GHCi. So this new interpreter will be running on top of GHCi which accepts syntax extension of Haskell. For example: Prelude :l

ghci bug with template Haskell

2005-02-03 Thread WANG Meng
Prelude let x = 1 Prelude $([|x|]) ghc.exe: panic! (the `impossible' happened, GHC version 6.2.2): nameModule x {- v a6XY -} Please report it as a compiler bug to, or Prelude -W-M- @ @ | \_/

[Haskell-cafe] `typeof' is not a (visible) method of class `Typeable' ?

2005-11-11 Thread WANG Meng
Hi All, While I was trying to declare Language.Haskell.TH.Exp as an instance of Typeable, ghci 6.4 yields this error. It does not allow me to define an instance of typeof. Does anybody know what should be the right way of doing this? Thanks. -W-M- @ @ | \_/