[Haskell] ANNOUNCE: HaRP (Haskell Regular Patterns) version 0.1

Dylan Thurston dpt at exoskeleton.math.harvard.edu
Sat May 15 17:51:29 EDT 2004


On Sat, May 15, 2004 at 04:42:03PM +0000, Niklas Broberg wrote:
> .... In non-linear context, the 
> type is a list of what it would otherwise be, regardless of what and how 
> many enclosing non-linear regular pattern operators.

So I guess that in

foo [/ a? 2 b /] = (a,b)

the type of a is '[Int]', not 'Maybe Int', right?

> Hopefully I make sense (more than before?).

Yes, I think that's clearer.

> I'm starting to think maybe our context dependent approach to implicit 
> bindings isn't very good after all since it seems to confuse a lot of 
> people. Perhaps variables bound inside regular patterns should always be 
> non-linear... of course that would still be context dependent when compared 
> to normal Haskell patterns, but perhaps still less confusing?

Alternatively, you could forbid the use of simple variables nonlinearly,
since there's an alternative way to write it.  Or, you could make
variables (and other pattern binding) more context dependent, recording
all the relevant parts of the context (and not just whether the context
is linear or not), if that makes sense.

Interesting issues, anyway!

By the way, are nested regular expression matches allowed?  Something
like:

foo :: [[Int]] -> Int
foo [/ _* [/ 5* a 6* /] _* /] = a

?  If so, what is the type of a in

foo [/ _* [/ 5* a* /]* _* /]

?

Peace,
	Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell/attachments/20040515/c91a8fd9/attachment.bin


More information about the Haskell mailing list