Skip to content

NodesIter.nodeEntries failed to typecheck #1

Description

@dsiu
open Graphology

let log = Console.log
let log2 = Console.log2

module Dict = Dict
module H = Graph.MakeGraph({
  type node = string
  type edge = string
})
let h = H.makeGraph()
"hi"->log
h->H.addNode("John", ~attr={"lastName": "Doe"})
h->H.addNode("Peter", ~attr={"lastName": "Egg"})
h->H.addNode("Mary")
h->H.addEdge("John", "Peter", ~attr={"dist": 23})
h->H.addEdge("Peter", "Mary", ~attr={"dist": 12})

let iter:it = h->H.NodesIter.nodeEntries
iter->log2("iter", _)
17 │ h->H.addEdge("Peter", "Mary", ~attr={"dist": 12})
  18 │ 
  19 │ let iter = h->H.NodesIter.nodeEntries
  20 │ iter->log2("iter", _)
  21 │ 

  This expression's type contains type variables that cannot be generalized:
  Iterator.t<H.NodesIter.nodeIterValue<{_..}>>
  
  This happens when the type system senses there's a mutation/side-effect,
  in combination with a polymorphic value.
  Using or annotating that value usually solves it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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