Created
June 24, 2019 21:46
-
-
Save justinwoo/f4e9732916fd0b0a03f60705840c6d53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Parens | |
(App (Select (Identifier "pkgs") (AttrPath "fetchFromGitHub")) | |
(AttrSet | |
[ (Bind (AttrPath "owner") (StringValue "\"justinwoo\"")) | |
, (Bind (AttrPath "repo") (StringValue "\"psc-package2nix\"")) | |
, (Bind (AttrPath "rev") (StringValue "\"b4d6a834ac124440a503f0510b8a9de95532b16c\"")) | |
, (Bind (AttrPath "sha256") (StringValue "\"0g9fq4j472bcr1x5na6mzr3av95xhvdmnlns1ncvsl4kqa8ix2zr\"")) | |
]))) | |
data Expr | |
-- top level | |
= Expression (Array Expr) | |
-- i just want to print comments | |
| Comment String | |
-- <nixpkgs> | |
| Spath String | |
-- ../whatever.nix | |
| Path String | |
-- "hi" | |
| StringValue String | |
-- integer, e.g. 123 | |
| Integer String | |
-- indented string | |
| StringIndented String | |
-- unary, e.g. !x, -a | |
| Unary String Expr | |
-- binary, e.g. a < b | |
| Binary Expr String Expr | |
-- Identifier | |
| Identifier String | |
-- function, input_expr: output_expr | |
| Function Expr Expr | |
-- set function, { formals }: output_expr | |
| SetFunction Expr Expr | |
-- the main thing, application of a function with its arg? | |
| App Expr Expr | |
-- let exprs in exprs | |
| Let (Array Expr) (Array Expr) | |
-- if cond_exprs then_exprs else_exprs | |
| If Expr Expr Expr | |
-- a set | |
| AttrSet (Array Expr) | |
-- a recursive attr set | |
| RecAttrSet (Array Expr) | |
-- parenthesized | |
| Parens Expr | |
-- a list | |
| List (Array Expr) | |
-- bind, e.g. owner = 1; | |
| Bind Expr Expr | |
-- attrpath, only contains Identifier? e.g. owner of owner = 1; | |
| AttrPath String | |
-- inherit | |
| Inherit (Array Expr) | |
-- with (thing); expr | |
| With Expr Expr | |
-- attributes for inherit? | |
| Attrs (Array Expr) | |
-- as in `set.attr`, Select expr selector_expr | |
| Select Expr Expr | |
-- set fn args, e.g. inside of braces { pkgs ? import <nixpkgs> {} }: | |
| Formals (Array Expr) | |
-- ellipses, they show up in formals | |
| Ellipses | |
-- set fn arg with an identifier, where it may or may not have a default value expr | |
| Formal Expr (Maybe Expr) | |
-- Uri | |
| Uri String | |
derive instance eqExpr :: Eq Expr | |
derive instance genericsExpr :: Generic Expr _ | |
instance showExpr :: Show Expr where | |
show x = genericShow x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment