> > data RegExp sigma = Empty | Epsilon | Sym sigma
 > >                   | Seq (RegExp sigma,RegExp sigma)
 > 
 > BTW, why not Seq (RegExp sigma) (RegExp sigma)?

Oops, I suppose the slogan is "Who uses Haskell has to Curry"... :-)
(I changed this).

 > > data (Fin sigma) => NFA' sigma = forall q. (Fin q) => NFA' (NFA q sigma)
 > 
 > > re2nfa:: (Fin sigma) => (RegExp sigma) -> (NFA' sigma)
 > 
 > > re2nfa (Seq (e1,e2)) = let NFA' a1 = re2nfa e1
 > >                       NFA' a2 = re2nfa e2
 > >                       in NFA' (a_seq a1 a2)
 > 
 > Try:
 > 
 > re2nfa (Seq (e1,e2)) = case re2nfa e1 of
 >     NFA' a1 -> case re2nfa e2 of
 >         NFA' a2 -> NFA' (a_seq a1 a2)
 > 
 > or even case (re2nfa e1, re2nfa e2) of ...

Thanks a lot , Marcin. This does the trick.

 > > RegExp.hs:57:
 > >     My brain just exploded.
 > >     I can't handle pattern bindings for existentially-quantified constructors.
 > 
 > > Did I encounter a limitation of the implementationbs of existential
 > > types or is there just a stupid bug in my code?
 > 
 > The former. Values with existential qualification must be "opened"
 > by either explicit case or a pattern in a parameter. They cannot be
 > opened by a let-binding.

Aha! Now I'd like to know whether there is a deeper reason behind
this? Or is it just due to the fact that existential types are not yet
properly integrated in the Haskell type system?

Cheers,
Thorsten

-- 
Dr. Thorsten Altenkirch                 phone : (+49 89) 2178-2209
Theoretical Computer Science            fax   : (+49 89) 2178-2238
LMU, D-80538 Munich, Germany            Oettingenstr 67, room D105
http://www.tcs.informatik.uni-muenchen.de/~alti

Reply via email to