Skip to content

Instantly share code, notes, and snippets.

@brendanzab
Last active June 25, 2021 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanzab/3ba57463d96c7be06b4a2e2b72b19a3c to your computer and use it in GitHub Desktop.
Save brendanzab/3ba57463d96c7be06b4a2e2b72b19a3c to your computer and use it in GitHub Desktop.
{
"record.term": {
"fields": {
"identity": { "node": "$identity" },
"compose": { "node": "$compose" },
"Unit": { "node": "$Unit" },
"Bool": { "node": "$Bool" },
"Option": { "node": "$Option" }
},
"nodes": {
"$identity": {
"deps": [],
"doc": "Given a value, returns exactly the same value.",
"type": {
"function.type": {
"inputs": {
"A": { "node": "$A" },
"a0": { "node": "$a" }
},
"outputs": {
"a1": { "node": "$a" }
},
"nodes": {
"$A": {
"deps": [],
"type": { "universe": {} }
},
"$a": {
"deps": ["$A"],
"type": { "node": "$A" }
}
}
}
},
"term": {
"function.term": {
"inputs": {
"A": { "node": "$A" },
"a0": { "node": "$a0" }
},
"outputs": {
"a1": { "node": "$a0" }
},
"nodes": {
"$A": {},
"$a0": {},
"$a1": {
"term": { "node": "$a0" }
}
}
}
}
},
"$compose": {
"deps": [],
"docs": "Glue two functions together, so that the result of one can be fed into the argument of the other.",
"type": {
"function.type": {
"inputs": {
"A": { "node": "$A" },
"B": { "node": "$B" },
"C": { "node": "$C" },
"a->b": { "node": "$a->b" },
"b->c": { "node": "$b->c" }
},
"outputs": {
"a->c": { "node": "$c" }
},
"nodes": {
"$A": {
"deps": [],
"type": { "universe": {} }
},
"$B": {
"deps": [],
"type": { "universe": {} }
},
"$C": {
"deps": [],
"type": { "universe": {} }
},
"$a->b": {
"deps": ["$A", "$B"],
"type": {
"function.type": {
"inputs": { "a": { "node": "$a" } },
"outputs": { "b": { "node": "$b" } },
"nodes": {
"$a": { "deps": ["$A"], "type": { "node": "$A" } },
"$b": { "deps": ["$B"], "type": { "node": "$B" } }
}
}
}
},
"$b->c": {
"deps": ["$B", "$C"],
"type": {
"function.type": {
"inputs": { "b": { "node": "$b" } },
"outputs": { "c": { "node": "$c" } },
"nodes": {
"$b": { "deps": ["$B"], "type": { "node": "$B" } },
"$c": { "deps": ["$C"], "type": { "node": "$C" } }
}
}
}
},
"$a->c": {
"deps": ["$A", "$C"],
"type": {
"function.type": {
"inputs": { "a": { "node": "$a" } },
"outputs": { "c": { "node": "$c" } },
"nodes": {
"$a": { "deps": ["$A"], "type": { "node": "$A" } },
"$c": { "deps": ["$C"], "type": { "node": "$C" } }
}
}
}
}
}
}
},
"term": {
"function.term": {
"inputs": {
"A": { "node": "$A" }
},
"outputs": {
"a->c": { "node": "$a->c" }
},
"nodes": {
"$A": {},
"$a->c": {
"deps": ["$c"],
"term": {
"function.term": {
"inputs": { "a": { "node": "$a" } },
"outputs": { "c": { "node": "$c" } },
"nodes": {
"$a": {},
"$b": {
"deps": ["$a", "$a->$b"],
"term": {
"function.elim": {
"head": { "node": "$a->b" },
"inputs": { "a": { "node": "$a" } }
}
}
},
"$c": {
"deps": ["$b", "$b->c"],
"term": {
"function.elim": {
"head": { "node": "$b->c" },
"inputs": { "b": { "node": "$b" } }
}
}
}
}
}
}
}
}
}
}
},
"$Unit": {
"deps": [],
"type": { "universe": {} },
"term": {
"record.type": {
"fields": {},
"nodes": {}
}
}
},
"$Bool": {
"deps": ["$Unit"],
"type": { "universe": {} },
"term": {
"variant.type": {
"nodes": {
"$true": {
"deps": ["$Unit"],
"type": { "node": "$Unit" }
},
"$false": {
"deps": ["$Unit"],
"type": { "node": "$Unit" }
}
}
}
}
},
"$Option": {
"deps": ["$Unit"],
"doc": "Represents a value that may or may not exist.",
"type": {
"function.type": {
"inputs": {
"A": { "node": "$A" }
},
"outputs": {
"Option-A": { "node": "$Option-A" }
},
"nodes": {
"$A": {
"deps": [],
"type": { "universe": {} }
},
"$Option-A": {
"deps": [],
"type": { "universe": {} }
}
}
}
},
"term": {
"function.term": {
"inputs": {
"A": { "node": "$A" }
},
"outputs": {
"Option-A": { "node": "$Option-A" }
},
"nodes": {
"$A": {},
"$Option-A": {
"term": {
"variant.type": {
"nodes": {
"$some": {
"deps": ["$A"],
"type": { "node": "$A" }
},
"$none": {
"deps": ["$Unit"],
"type": { "node": "$Unit" }
}
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment