fpco / inline-c

284 stars 51 forks source link

Inline-c build failing #144

Closed SturdyPose closed 1 year ago

SturdyPose commented 1 year ago

Inline-c is part of Haskell Imgui's dependency and for some reason, during build step it fails.

Below is compilation error. My environment is:

Preprocessing library for inline-c-0.9.1.7..
Building library for inline-c-0.9.1.7..
[1 of 9] Compiling Language.C.Inline.FunPtr ( src\Language\C\Inline\FunPtr.hs, dist\build\Language\C\Inline\FunPtr.o )
[2 of 9] Compiling Language.C.Types.Parse ( src\Language\C\Types\Parse.hs, dist\build\Language\C\Types\Parse.o )

src\Language\C\Types\Parse.hs:534:12: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: String
                -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: String -> Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    CIdentifier -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:534:3-8
    * In the first argument of `(.)', namely `PP.text'
      In the expression: PP.text . unCIdentifier
      In an equation for `pretty': pretty = PP.text . unCIdentifier
    * Relevant bindings include
        pretty :: CIdentifier
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:534:3)
    |
534 |   pretty = PP.text . unCIdentifier
    |            ^^^^^^^

src\Language\C\Types\Parse.hs:563:16: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    TypeSpecifier -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:552:3-8
    * In the expression: "struct" <+> pretty x
      In a case alternative: Struct x -> "struct" <+> pretty x
      In the expression:
        case tySpec of
          VOID -> "void"
          BOOL -> "bool"
          CHAR -> "char"
          SHORT -> "short"
          INT -> "int"
          LONG -> "long"
          FLOAT -> "float"
          DOUBLE -> "double"
          SIGNED -> "signed"
          UNSIGNED -> "unsigned"
          Struct x -> "struct" <+> pretty x
          Enum x -> "enum" <+> pretty x
          TypeName x -> pretty x
          Template x args
            -> let concat_with_space = ...
               in
                 pretty x <+> "<"
                   <+> mconcat (intersperse "," (map concat_with_space args))
                   <+> ">"
          TemplateConst x -> pretty x
          TemplatePointer x -> pretty x <+> "*"
    * Relevant bindings include
        pretty :: TypeSpecifier
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:552:3)
    |
563 |    Struct x -> "struct" <+> pretty x
    |                ^^^^^^^^^^^^^^^^^^^^^

src\Language\C\Types\Parse.hs:587:12: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    Declarator i -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:585:3-8
    * In the expression: prettyPointers ptrs <+> pretty ddecltor
      In a case alternative:
          _ : _ -> prettyPointers ptrs <+> pretty ddecltor
      In the expression:
        case ptrs of
          [] -> pretty ddecltor
          _ : _ -> prettyPointers ptrs <+> pretty ddecltor
    * Relevant bindings include
        pretty :: Declarator i
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:585:3)
    |
587 |     _:_ -> prettyPointers ptrs <+> pretty ddecltor
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src\Language\C\Types\Parse.hs:594:36: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    Pointer -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:594:3-8
    * In the second argument of `(<>)', namely
        `hsep (map pretty tyQual)'
      In the expression: "*" <> hsep (map pretty tyQual)
      In an equation for `pretty':
          pretty (Pointer tyQual) = "*" <> hsep (map pretty tyQual)
    * Relevant bindings include
        pretty :: Pointer
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:594:3)
    |
594 |   pretty (Pointer tyQual) = "*" <> hsep (map pretty tyQual)
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^

src\Language\C\Types\Parse.hs:605:23: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    ArrayOrProto i
                    -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:603:3-8
    * In the first argument of `(<>)', namely `prettyParams x'
      In the second argument of `(<>)', namely `prettyParams x <> ")"'
      In the expression: "(" <> prettyParams x <> ")"
    * Relevant bindings include
        pretty :: ArrayOrProto i
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:603:3)
    |
605 |     Proto x -> "(" <> prettyParams x <> ")"
    |                       ^^^^^^^^^^^^^^

src\Language\C\Types\Parse.hs:623:12: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    ParameterDeclaration i
                    -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:621:3-8
    * In the expression: hsep (map pretty declSpecs) <+> decltorDoc
      In a case alternative:
          _ : _ -> hsep (map pretty declSpecs) <+> decltorDoc
      In the expression:
        case declSpecs of
          [] -> decltorDoc
          _ : _ -> hsep (map pretty declSpecs) <+> decltorDoc
    * Relevant bindings include
        pretty :: ParameterDeclaration i
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:621:3)
    |
623 |     _:_ -> hsep (map pretty declSpecs) <+> decltorDoc
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src\Language\C\Types\Parse.hs:631:21: error:
    * Couldn't match type `ann'
                     with `prettyprinter-ansi-terminal-1.1.2:Prettyprinter.Render.Terminal.Internal.AnsiStyle'
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      `ann' is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    AbstractDeclarator i
                    -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at src\Language\C\Types\Parse.hs:630:3-8
    * In the expression: prettyPointers ptrs
      In a case alternative: (_, Nothing) -> prettyPointers ptrs
      In the expression:
        case (ptrs, mbDecltor) of
          (_, Nothing) -> prettyPointers ptrs
          ([], Just x) -> pretty x
          (_ : _, Just x) -> prettyPointers ptrs <+> pretty x
    * Relevant bindings include
        pretty :: AbstractDeclarator i
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at src\Language\C\Types\Parse.hs:630:3)
    |
631 |     (_, Nothing) -> prettyPointers ptrs
    |                     ^^^^^^^^^^^^^^^^^^^
bitonic commented 1 year ago

The new ansi-wl-pprint is a shim for prettyprinter, but its typeclass is too generic for the shim functions. For now I've tightened the ansi-wl-pprint upper bound in https://hackage.haskell.org/package/inline-c-0.9.1.8 , could you try again?

SturdyPose commented 1 year ago

Oh wow! Problem disappeared! Thanks for quick response and solution!