Open epsilonhalbe opened 7 years ago
Here is a minimal showcase of the error I am facing:
If I declare a newtype datatype - then flags produce runtime errors. For data-declarations everything seems to work just fine.
newtype
data
{-# LANGUAGE DeriveDataTypeable #-} module Main where import System.Console.CmdArgs --------------------------------------------------------------------------------- -- Newtypes seem to make problems with CMDARGS -- --------------------------------------------------------------------------------- newtype NewtypeSample = NewtypeSample {helloNT :: FilePath } deriving (Show, Data, Typeable) worksNT = NewtypeSample{helloNT = def &= help "World argument" } &= summary "NewtypeSample v1" doesn'tWorkNT1 = NewtypeSample{helloNT = def &= help "World argument" &= opt "world" &= typFile} &= summary "NewtypeSample v1" doesn'tWorkNT2 = NewtypeSample{helloNT = def &= help "World argument" &= opt "world"} &= summary "NewtypeSample v1" --------------------------------------------------------------------------------- -- Data declarations seem to work just fine -- --------------------------------------------------------------------------------- data DataSample = DataSample {helloD :: FilePath } deriving (Show, Data, Typeable) worksD1 = DataSample{helloD = def &= help "World argument" &= opt "world"} &= summary "DataSample v1" worksD2= DataSample{helloD = def &= help "World argument" &= opt "world" &= typFile} &= summary "DataSample v1" main :: IO () main = do print =<< cmdArgs doesn'tWorkNT1 print =<< cmdArgs doesn'tWorkNT2 print =<< cmdArgs worksNT print =<< cmdArgs worksD1 print =<< cmdArgs worksD2 return ()
Here are the errors I get:
doesn'tWorkNT1
stack build && stack exec -- cmdargsbug cmdargsbug-0.1.0.0: build (exe) Preprocessing executable 'cmdargsbug' for cmdargsbug-0.1.0.0... [1 of 1] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/cmdargsbug/cmdargsbug-tmp/Main.o ) Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/cmdargsbug/cmdargsbug ... cmdargsbug-0.1.0.0: copy/register Installing executable(s) in ..../cmdargsbug/.stack-work/install/x86_64-linux/lts-8.17/8.0.2/bin cmdargsbug: System.Console.CmdArgs.Implicit, unexpected mode: FlagType "FILE" CallStack (from HasCallStack): error, called at ./System/Console/CmdArgs/Implicit/Local.hs:106:11 in cmdargs-0.10.17-IWa8ygdJhnJBShkQXN8V9I:System.Console.CmdArgs.Implicit.Local
commenting out the doesn'tWorkNT1 line produces
doesn'tWorkNT2
stack build && stack exec -- cmdargsbug cmdargsbug-0.1.0.0: build (exe) Preprocessing executable 'cmdargsbug' for cmdargsbug-0.1.0.0... [1 of 1] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/cmdargsbug/cmdargsbug-tmp/Main.o ) Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/cmdargsbug/cmdargsbug ... cmdargsbug-0.1.0.0: copy/register Installing executable(s) in ..../cmdargsbug/.stack-work/install/x86_64-linux/lts-8.17/8.0.2/bin cmdargsbug: System.Console.CmdArgs.Implicit, unexpected mode: FlagOptional "world" CallStack (from HasCallStack): error, called at ./System/Console/CmdArgs/Implicit/Local.hs:106:11 in cmdargs-0.10.17-IWa8ygdJhnJBShkQXN8V9I:System.Console.CmdArgs.Implicit.Local
Here is a minimal showcase of the error I am facing:
If I declare a
newtype
datatype - then flags produce runtime errors. Fordata
-declarations everything seems to work just fine.Here are the errors I get:
doesn'tWorkNT1
commenting out the
doesn'tWorkNT1
line producesdoesn'tWorkNT2