What about tuple accessor function for (,,) ... - ?
Marc Weber
marco-oweber at gmx.de
Wed Apr 25 11:09:19 EDT 2007
Hi Neil.
> The Yhc compiler uses 8 element tuples in some places - its not a good
> solution ever.
Using them I would be counting commas all the time ;)
> I suspect the use of the 2 element tuple is really common, the 3
> element tuple sees a few outings, and the 4 and above element tuple is
> a bit of a rarity.
Thanks for your answer.
This 4 tuple design can be found in regex-base (Text.Regex.Base.Context)
(before, match, after, [submatch])
I only did need the submatches.
tuple -> hlist -> get 3 element would be an option too ;)
But you are right. It would be mutch better to use
(BMAS = Before Match After Submatches)
data BMASContext = BMASContext { before:: , match:: , after::,
submatches :: .. }
Then I could do submatches ( "..." =~ "..." ) which would be a lot more
readable, too.
You can define your own.
I have to dive into the regex code much deeper..
It should have been a quick hack :)
Marc
More information about the Libraries
mailing list