I've isolated the below small piece of code that is giving me a stack
overflow. I'm kind of at a loss as has to fix, or even find what is
happening here. (The real program is reading the data from a file,
and doing something more complex with it). I'm not even sure how to
work around this
On 21.04 11:21, David Brown wrote:
I've isolated the below small piece of code that is giving me a stack
overflow. I'm kind of at a loss as has to fix, or even find what is
happening here. (The real program is reading the data from a file,
and doing something more complex with it). I'm not
I would like to default IsString to use the Text instance to avoid
ambiguous type errors.
I see defaulting capability is available for Num. Is there any way to
do this for IsString?
Thanks,
Greg Weber
___
Glasgow-haskell-users mailing list
Pretty sure it does default to String, anyway:
{-# LANGUAGE OverloadedStrings #-}
main = print (show Hello!)
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
I think it'll be hard to do that without putting Text in base, which I'm
not sure anyone wants to do.
Dan
On Sat, Apr 21, 2012 at 8:20 PM, Greg Weber g...@gregweber.info wrote:
I would like to default IsString to use the Text instance to avoid
ambiguous type errors.
I see defaulting
my actual use case looks more like this:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
import Data.Text as T
class ShowT a where
showT :: a - String
instance ShowT T.Text where
showT = show
instance ShowT String where
showT = show
main =
This is a better demonstration of the issue. I am going to open a GHC
bug report, as I can't see how this behavior is desirable.
{-# LANGUAGE OverloadedStrings #-}
import Data.Text as T
classNoDefault a where noDefault :: a - Text
instance NoDefault T.Text where noDefault = id
main =