[Haskell-cafe] Re: instance Enum [Char] where ...
Henning Thielemann
schlepptop at henning-thielemann.de
Tue Dec 30 19:11:02 EST 2008
Justin Goguen schrieb:
> My purpose is to have operations such as ["aa".."bc"] be possible, with its
> result being ["aa", "ab", "ac" ..<snip>.. "ba", "bb", "bc"]
... what do you want to get, if the lengths of the start and the end
string do not match?
Maybe what you are after is the Ix class:
Prelude> Data.Ix.range (('a','a'), ('b','c'))
[('a','a'),('a','b'),('a','c'),('b','a'),('b','b'),('b','c')]
Prelude> map (\(x,y) -> x:y:[]) $ Data.Ix.range (('a','a'), ('b','c'))
["aa","ab","ac","ba","bb","bc"]
More information about the Haskell-Cafe
mailing list