[Haskell-cafe] Text.Regex.matchRegex: Success is empty?

Jeffrey Brown jeffbrown.the at gmail.com
Tue Apr 5 20:16:54 UTC 2016


Esteemed Haskellers,

It is working for me, but I am puzzled by the matchRegex function:

    > import Text.Regex
    > :i matchRegex
    matchRegex :: Regex -> String -> Maybe [String]
            -- Defined in ‘Text.Regex’

Searches that fail return Nothing:

    > matchRegex (mkRegex "z") "abracadabra"
    Nothing

which makes sense. But why do searches that succeed return an empty list of
Strings?

    > matchRegex (mkRegex "a") "abracadabra"
    Just []
    >

-- 
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160405/6965b3cb/attachment.html>


More information about the Haskell-Cafe mailing list