Wed, 10 May 2000 13:04:19 +0200 (CEST), Thorsten Altenkirch
<[EMAIL PROTECTED]> pisze:
> data RegExp sigma = Empty | Epsilon | Sym sigma
> | Seq (RegExp sigma,RegExp sigma)
BTW, why not Seq (RegExp sigma) (RegExp sigma)?
> 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 ...
> 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.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-