MicroHs icon indicating copy to clipboard operation
MicroHs copied to clipboard

Cannot build optparse-applicative

Open Bodigrim opened this issue 5 months ago • 1 comments

$ git clone -b microhs https://github.com/Bodigrim/optparse-applicative && cd optparse-applicative && mcabal -r install
mcabal: Building library optparse-applicative

mhs: uncaught exception: error: "src/Options/Applicative/Types.hs": line 102, col 14: Cannot satisfy constraint: (b#1068 ~ a#1067)
     fully qualified: (Primitives.~ b#1068 a#1067)

mcabal: uncaught exception: error: "./lib/System/Process.hs",12:5: callCommand: failed 256, "mhs -Poptparse-applicative-0.17.0.0 -odist-mcabal/optparse-applicative-0.17.0.0.pkg -i -isrc -idist-mcabal/autogen '-DVERSION_ghc_compat=\"0.5.0.0\"' '-DMIN_VERSION_ghc_compat(x,y,z)=((x)<0||(x)==0&&(y)<5||(x)==0&&(y)==5&&(z)<=0)' '-DVERSION_base=\"4.19.1.0\"' '-DMIN_VERSION_base(x,y,z)=((x)<4||(x)==4&&(y)<19||(x)==4&&(y)==19&&(z)<=1)' '-DVERSION_transformers=\"0.6.2.0\"' '-DMIN_VERSION_transformers(x,y,z)=((x)<0||(x)==0&&(y)<6||(x)==0&&(y)==6&&(z)<=2)' -a. Options.Applicative Options.Applicative.Arrows Options.Applicative.BashCompletion Options.Applicative.Builder Options.Applicative.Builder.Completer Options.Applicative.Builder.Internal Options.Applicative.Common Options.Applicative.Extra Options.Applicative.Help Options.Applicative.Help.Chunk Options.Applicative.Help.Core Options.Applicative.Help.Levenshtein Options.Applicative.Help.Pretty Options.Applicative.Help.Types Options.Applicative.NonEmpty Options.Applicative.Types Options.Applicative.Internal"

The line in question looks quite benign to me:

data ParserInfo a = ParserInfo
  { infoParser :: Parser a    -- ^ the option parser for the program
  , infoFullDesc :: Bool      -- ^ whether the help text should contain full
                              -- documentation
  , infoProgDesc :: Chunk Doc -- ^ brief parser description
  , infoHeader :: Chunk Doc   -- ^ header of the full parser description
  , infoFooter :: Chunk Doc   -- ^ footer of the full parser description
  , infoFailureCode :: Int    -- ^ exit code for a parser failure
  , infoPolicy :: ArgPolicy   -- ^ allow regular options and flags to occur
                              -- after arguments (default: InterspersePolicy)
  }

instance Functor ParserInfo where
  fmap f i = i { infoParser = fmap f (infoParser i) }

Bodigrim avatar Nov 22 '25 13:11 Bodigrim

The problem is that MicroHs does not allow record update that changes the type of a polymorphic record. I think I'll change MicroHs to allow it.

augustss avatar Nov 22 '25 15:11 augustss

It compiles now, with two tiny changes. I've submitted a PR.

augustss avatar Dec 16 '25 15:12 augustss