Skip to content

type-defaults warning occurs before first commit #12

Closed
@wataru86

Description

@wataru86

I tried using optparse-simple of github version 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)

type-defaults warning occured in these cases.

  • When there is no .git directory.
  • When I did git init, but did not git commit.
$ stack build
optparse-simple-0.1.1: configure (lib)
optparse-simple-0.1.1: build (lib)
optparse-simple-0.1.1: copy/register
Building all executables for `SampleA' once. After a successful build of all of them, only specified executables will be rebuilt.
SampleA-0.1.0.0: configure (exe)
Configuring SampleA-0.1.0.0...
SampleA-0.1.0.0: build (exe) 
Preprocessing executable 'SampleA-exe' for SampleA-0.1.0.0..
Building executable 'SampleA-exe' for SampleA-0.1.0.0..
[1 of 2] Compiling Paths_SampleA    ( .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/autogen/Paths_SampleA.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/SampleA-exe-tmp/Paths_SampleA.o )
[2 of 2] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/SampleA-exe-tmp/Main.o )
                             
/home/yamada/test/190106/test/SampleA/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/SampleA-exe/SampleA-exe ...
                             
SampleA-0.1.0.0: copy/register
Installing executable SampleA-exe in /home/yamada/test/190106/test/SampleA/.stack-work/install/x86_64-linux/lts-13.1/8.6.3/bin
Completed 2 action(s).   

After git commit, I didn't get the warning.

$ git add .
$ git commit -m "Add files"
[master (root-commit) 543addf] Add files
 5 files changed, 38 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 README.md
 create mode 100644 app/Main.hs
 create mode 100644 package.yaml
 create mode 100644 stack.yaml
$ stack clean --full
$ stack build
optparse-simple-0.1.1: configure (lib)
optparse-simple-0.1.1: build (lib) 
optparse-simple-0.1.1: copy/register
Building all executables for `SampleA' once. After a successful build of all of them, only specified executables will be rebuilt.
SampleA-0.1.0.0: configure (exe)   
Configuring SampleA-0.1.0.0...     
SampleA-0.1.0.0: build (exe) 
Preprocessing executable 'SampleA-exe' for SampleA-0.1.0.0..
Building executable 'SampleA-exe' for SampleA-0.1.0.0..
[1 of 2] Compiling Paths_SampleA    ( .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/autogen/Paths_SampleA.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/SampleA-exe-tmp/Paths_SampleA.o )
[2 of 2] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/SampleA-exe-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/SampleA-exe/SampleA-exe ...
SampleA-0.1.0.0: copy/register
Installing executable SampleA-exe in /home/yamada/test/190106/test/SampleA/.stack-work/install/x86_64-linux/lts-13.1/8.6.3/bin
Completed 2 action(s).   

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