<[hidden email]> 2009-01-03T08:17:00Z
> I am bit struggling with understanding the typeclasses usage
> in Text.Regex.Posix (=~) [...] My question is that can I
> understand source1 in the way which is a value has type of
> RegexMaker, Regex, CompOption and ExecOption?
The type `source1 -> source -> target` such that both "class
constraints" are satisfied.
What is a class contraint and what does it mean for it to be
satisfied? A class contraint is something like an interface,
or a generic, or a template. One defines "instances" of
classes in Haskell, as in Jave one "implements" an interface.
So what do these particular classes mean? The first one reads:
We have a way to make a regular expression using the usual
option specifications (multiline, case insensitive, stuff
like that -- those are `CompOption` and `ExecOption`).
The second one reads
There is a way to match the first value against the second
to get the desired target value (list of matches, Boolean,
The "way to..." in each case is a function in the class
definition -- `makeRegex` in the former case, and `match` in