[Haskell-cafe] ByteString in patterns

Don Stewart dons at galois.com
Wed Mar 11 12:25:49 EDT 2009


manlio_perillo:
> Don Stewart ha scritto:
>> manlio_perillo:
>>> Don Stewart ha scritto:
>>>> [...]
>>>>     {-# LANGUAGE OverloadedStrings #-}
>>>>
>>>>     import qualified Data.ByteString.Char8 as C
>>>>
>>>>     isMatch :: C.ByteString -> Bool
>>>>     isMatch "match" = True
>>>>     isMatch _       = False
>>>>
>>>>     main = print . map isMatch . C.lines =<< C.getContents
>>>>
>>> What is the reason why instance declarations for IsString class are 
>>> not  defined for available ByteStrings?
>>>
>>> I need to define it by myself.
>>
>> They're exported from Data.ByteString.Char8
>>
>
> Then there is something I'm missing.
> Your code does not compile.

Sure it does:

    $ ghci A.hs  
    GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
    Loading package ghc-prim ... linking ... done.
    Loading package integer ... linking ... done.
    Loading package base ... linking ... done.
    [1 of 1] Compiling Main             ( A.hs, interpreted )
    Ok, modules loaded: Main.

    *Main> :t main
    main :: IO ()

You should give any error message, and the steps you took that lead to
the error when making a bug report.

-- Don


More information about the Haskell-Cafe mailing list