Skip to content

Missing type arguments in recursive types #5

@jhrcek

Description

@jhrcek

After fixing the build error reported in

I encountered the following code generation bug

data Tree a
  = Leaf
  | Node { nodeValue :: a, nodeChildren :: [Tree a] }
  deriving (Generic, ToHType)

-- in separate module
src :: Text
src = $(generateFor Elm0p19 defaultOptions "Repro" Nothing $
    include (Proxy :: Proxy (Tree Int)) $ Everything Poly)

the following elm code is generated:

type Tree a = Leaf | Node { nodeValue : a, nodeChildren : List Tree } 

but this is rejected by compiler (missing type argument - should be nodeChildren : List (Tree a)).

Detected problems in 1 module.
-- TOO FEW ARGS ----------------------------------------------- Parametrized.elm

The `Tree` type needs 1 argument, but I see 0 instead:

61| type Tree a = Leaf | Node { nodeValue : a, nodeChildren : List Tree } 
                                                                   ^^^^
What is missing? Are some parentheses misplaced?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions