[Haskell-cafe] Re: Interest in helping w/ Haskell standard

John Meacham john at repetae.net
Fri Oct 14 20:48:01 EDT 2005

On Fri, Oct 14, 2005 at 03:34:33PM +0100, Jon Fairbairn wrote:
> On 2005-10-14 at 16:25+0200 Stephane Bortzmeyer wrote:
> > On Fri, Oct 14, 2005 at 04:20:24PM +0200,
> >  Wolfgang Jeltsch <wolfgang at jeltsch.net> wrote 
> >  a message of 23 lines which said:
> > 
> > > By the way, it should be possible to handle regular expressions in
> > > an Haskell-like way.
> > 
> > If you like so, but as one more possibility, not as the only way.
> > 
> > > I always couldn't understand why one has to write regular
> > > expressions as strings
> > 
> > Because the language used inside these strings is standard,
> > multi-language, widely used and documented?
> 10,000 lemmings can't be wrong?
> Using strings for regexps is a disaster. Not even the syntax
> of such regexps is checked at compile time. (This was part
> of the point of my April 1st "joke" by the way).
> The language would certainly benefit from the inclusion of
> regexps the way Wolfgang suggested, but if we really need
> the short-form syntax (I'm not convinced; it seems pretty
> much a write only notation), then do it by having special
> syntax as a shorthand for the proper Haskell.
> Since Unicode is increasingly adopted, we could just use
> «regexp» and specify some rules to convert the regexp into
> Haskell, as "..." is meant to stand for '.':'.':'.':[].

my perl-like regexps for haskell package adds (=~) that works very
similarly to the perl operator, but is much more flexible since we have
so many types to work with rather than just scalar or list context. in
any case it uses a typeclass for regexs and what sort of thing they
work on. so you could do

foo =~ ".*foo$"
let regex = mkRegex ".*foo$" -- so the building of the regex will be
foo =~ regex
foo =~ (my fancy regex domain specific language)

I should cabalize it...

John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell-Cafe mailing list