digitallyinduced/ihp

`Could not deduce (IsString string0)` when using logger (from v0.10.0 onwards)

开放

#927 创建于 2021年6月20日

 (3 条评论) (0 个反应) (0 位负责人)Haskell (221 个派生)batch import
enhancementgood first issue

仓库指标

星标
 (5,285 个星标)
PR 合并指标
 (平均合并 11小时 20分钟) (30 天内合并 21 个 PR)

描述

Upon upgrading from 0.9.0 to 0.10.0 I get an error on this:

Log.debug "Some log message"

The error:

    • Could not deduce (IsString string0)
        arising from the literal '"Some log message"'
...
      The type variable 'string0' is ambiguous
      These potential instances exist:
        instance IsString Value
          -- Defined in 'aeson-1.5.4.1:Data.Aeson.Types.Internal'
        instance IsString ByteString
          -- Defined in 'Data.ByteString.Internal'
        instance (a ~ Char) => IsString (Seq a)
          -- Defined in 'Data.Sequence.Internal'
        ...plus four others
        ...plus 37 instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)

Doing this works:

Log.debug ("Some log message" :: Text)

But that's a bit annoying to do everywhere. Anything smart I can do with my imports or something to avoid having to do that? Or must I be doing something weird to get this error in the first place?

Ref https://ihpframework.slack.com/archives/C01DQE0F4F8/p1624128600130600

贡献者指南