<div dir="ltr">I see. That's what I did exactly, thanks for the help.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 11, 2015 at 2:12 PM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">No, the token will still be Char. You'll need to unpack Text into [Char]<br>
beforehand, and pack the result back if appropriate.<br>
<div><div class="h5"><br>
On 11/02/15 13:07, Konstantine Rybnikov wrote:<br>
> I just tried some regex-applicative and it's amazing! Very nice library,<br>
> thanks Roman!<br>
><br>
> However, I can't figure out the best way to work with Data.Text.Text<br>
> instead of String. The token would be Text, I guess, but then it breaks<br>
> in composition, since type of `few anySym` would now return `[Text]`,<br>
> not `Text`.<br>
><br>
> Am I understanding this correctly that intention is to in issue #8? [0]<br>
> Or is there a clever way to work with them today?<br>
><br>
> Example code:<br>
><br>
> {-# LANGUAGE OverloadedStrings #-}<br>
><br>
> import qualified Data.Text as T<br>
> import Data.Text (Text)<br>
> import Text.Regex.Applicative<br>
><br>
> main = do<br>
>   let input = "foo:\n--- blablabla\ttheend"<br>
>   let r1 = sym "foo:\n"<br>
>                       *> sym "--- " *> few anySym <* sym "\t" <* few anySym<br>
>             :: RE Text Text<br>
><br>
>   putStrLn (show (input =~ r1))<br>
><br>
> Error is something like (this is an error for a bit different code, but<br>
> should be very similar):<br>
><br>
> Main.hs:14:40:<br>
>     Couldn't match type ‘[Text]’ with ‘Text’<br>
>     Expected type: RE Text Text<br>
>       Actual type: RE Text [Text]<br>
>     In the second argument of ‘(*>)’, namely ‘few anySym’<br>
>     In the first argument of ‘(<*)’, namely<br>
>       ‘few anySym *> sym "Actual stderr output differs from expected:"<br>
>        *> sym "--- "<br>
>        *> few anySym’<br>
><br>
> Thanks!<br>
><br>
> [0]: <a href="https://github.com/feuerbach/regex-applicative/issues/8" target="_blank">https://github.com/feuerbach/regex-applicative/issues/8</a><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
<br>
</blockquote></div><br></div>