Skip to content

OverloadedStrings causes type-defaults warning #11

Closed
@wataru86

Description

@wataru86

I tried using optparse-simple in my repository.
I added OverloadedStrings pragma to Sample.hs.

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import           Options.Applicative.Simple (simpleVersion)
import qualified Paths_SampleA as Meta

main :: IO ()
main = putStrLn $(simpleVersion Meta.version)

First, I tried using github version. (SampleA)
I wrote stack.yaml as below.

resolver: lts-13.1
packages:
- .
extra-deps:
- github: fpco/optparse-simple
  commit: 2e816d643e813a32057242c6992ff7ce9c9eceb1

There was no warning.

Next, I tried using hackage version. (SampleB)
I wrote stack.yaml as below.

resolver: lts-13.1
packages:
- .

I got the following type-defaults warning.

$ stack build
Building all executables for `SampleB' once. After a successful build of all of them, only specified executables will be rebuilt.
SampleB-0.1.0.0: configure (exe)
Configuring SampleB-0.1.0.0...
SampleB-0.1.0.0: build (exe)
Preprocessing executable 'SampleB-exe' for SampleB-0.1.0.0..
Building executable 'SampleB-exe' for SampleB-0.1.0.0..
[1 of 2] Compiling Paths_SampleB    ( .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleB-exe/autogen/Paths_SampleB.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleB-exe/SampleB-exe-tmp/Paths_SampleB.o )
[2 of 2] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleB-exe/SampleB-exe-tmp/Main.o )

/home/yamada/test/190106/sample-optparse-simple/SampleB/app/Main.hs:9:19: warning: [-Wtype-defaults]
    • Defaulting the following constraint to type ‘[Char]’
        Data.String.IsString a0
          arising from the literal ‘"GHEGitRunFailed "." ["rev-parse","--show-toplevel"] (ExitFailure 128) "" "fatal: Not a git repository (or any of the parent directories): .git\n""’
    • In the first argument of ‘Left’, namely
        ‘"GHEGitRunFailed "." ["rev-parse","--show-toplevel"] (ExitFailure 128) "" "fatal: Not a git repository (or any of the parent directories): .git\n""’
      In the expression:
        Left
          "GHEGitRunFailed "." ["rev-parse","--show-toplevel"] (ExitFailure 128) "" "fatal: Not a git repository (or any of the parent directories): .git\n""
      In the second argument of ‘(++)’, namely
        ‘(case
              Left
                "GHEGitRunFailed "." ["rev-parse","--show-toplevel"] (ExitFailure 128) "" "fatal: Not a git repository (or any of the parent directories): .git\n""
          of
            Left _ -> []
            Right gi_a6X0
              -> [", Git revision ", githash-0.1.3.0:GitHash.giHash gi_a6X0,
                  if githash-0.1.3.0:GitHash.giDirty gi_a6X0 then
                      " (dirty)"
                  else
                      ""])’
  |
9 | main = putStrLn $(simpleVersion Meta.version)
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
Linking .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleB-exe/SampleB-exe ...

SampleB-0.1.0.0: copy/register
Installing executable SampleB-exe in /home/yamada/test/190106/sample-optparse-simple/SampleB/.stack-work/install/x86_64-linux/lts-13.1/8.6.3/bin

GitHub version is almost the same as hackage version.
Why does hackage version got warning?

stack version is 1.9.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions